From 226343bba888d7f2c04794b8a8eb13e04c8677a5 Mon Sep 17 00:00:00 2001 From: Douglas DUTEIL Date: Wed, 24 Jan 2024 15:57:16 +0100 Subject: [PATCH] feat(legacy): mark rejected moderations --- src/legacy/moderations/03.tsx | 2 +- src/legacy/moderations/route.tsx | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/legacy/moderations/03.tsx b/src/legacy/moderations/03.tsx index 41c9aa85..c64ee797 100644 --- a/src/legacy/moderations/03.tsx +++ b/src/legacy/moderations/03.tsx @@ -420,7 +420,7 @@ function MarkModerationProcessed({ moderation }: { moderation: Moderation }) {
() .basePath("/:id") .route("/comment", moderation_comment_router) .get( @@ -52,8 +54,11 @@ const moderation_router = new Hono() [RESPONSE_TEXTAREA_ID]: z.string().trim(), }), ), - async ({ text, req, notFound }) => { + async ({ text, req, notFound, redirect, var: { session } }) => { const { id: moderation_id } = req.valid("param"); + const userinfo = session.get("userinfo"); + if (!userinfo) return redirect("/"); + const username = userinfo_to_username(userinfo); const { [EMAIL_SUBJECT_INPUT_ID]: subject, [RESPONSE_TEXTAREA_ID]: body, @@ -71,7 +76,7 @@ const moderation_router = new Hono() if (!moderation.ticket_id) return notFound(); await send_zammad_mail({ - body: body.replace(/\n/g, "
"), + body: body.concat(`\n${username}`).replace(/\n/g, "
"), subject, ticket_id: moderation.ticket_id, state: "closed",