From 24f2a8ad5353803ed39260d3ed8843c3a0c41bcb Mon Sep 17 00:00:00 2001 From: potts99 Date: Sun, 3 Dec 2023 20:10:12 +0000 Subject: [PATCH] public comments update --- apps/api/src/controllers/ticket.ts | 2 +- apps/api/src/lib/nodemailer/ticket/comment.ts | 2 + apps/client/pages/tickets/[id].tsx | 37 +++++++++++++------ 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/apps/api/src/controllers/ticket.ts b/apps/api/src/controllers/ticket.ts index f95d118a9..ccad33cd3 100644 --- a/apps/api/src/controllers/ticket.ts +++ b/apps/api/src/controllers/ticket.ts @@ -417,7 +417,7 @@ export function ticketRoutes(fastify: FastifyInstance) { await prisma.comment.create({ data: { text: text, - public: Boolean(false), + public: public_comment, ticketId: id, userId: user!.id, }, diff --git a/apps/api/src/lib/nodemailer/ticket/comment.ts b/apps/api/src/lib/nodemailer/ticket/comment.ts index 5d13ab82a..dffcde6a9 100644 --- a/apps/api/src/lib/nodemailer/ticket/comment.ts +++ b/apps/api/src/lib/nodemailer/ticket/comment.ts @@ -9,6 +9,8 @@ export async function sendComment( try { let mail; + console.log("Sending email to: ", email); + const emails = await prisma.email.findMany(); if (emails.length > 0) { diff --git a/apps/client/pages/tickets/[id].tsx b/apps/client/pages/tickets/[id].tsx index 34d50c5f4..c70333442 100644 --- a/apps/client/pages/tickets/[id].tsx +++ b/apps/client/pages/tickets/[id].tsx @@ -723,16 +723,22 @@ export default function Ticket() { {item.user.name} -

- {/* {item.public - ? "Publicly" - : "Internally"} - {t("commented_at")} */} - Commented at{" "} - {moment(item.createdAt).format( - "DD/MM/YYYY hh:mm" - )} -

+
+ + {item.public + ? "Publicly" + : "Internally"} + + + commented at + + + + {moment( + item.createdAt + ).format("DD/MM/YYYY hh:mm")} + +
{item.text} @@ -1523,7 +1529,16 @@ export default function Ticket() { )} {editTime && (
-
+
+ setTimeSpent(e.target.value)} + />