From bac9f1f73ca6880085295f7d983504031f76d27b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 26 Feb 2026 16:04:07 -0500 Subject: [PATCH] refactor: add topic-await-review notif text add bodyEmail, use it for email body if provided, otherwise fallback to bodyLong as usual change mergeId of post queue notifs so they are not all merged into one. --- public/language/en-GB/notifications.json | 1 + src/notifications.js | 2 +- src/posts/queue.js | 15 ++++++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/public/language/en-GB/notifications.json b/public/language/en-GB/notifications.json index 4daeda5934..73832464dc 100644 --- a/public/language/en-GB/notifications.json +++ b/public/language/en-GB/notifications.json @@ -72,6 +72,7 @@ "new-register-multiple": "There are %1 registration requests awaiting review.", "flag-assigned-to-you": "Flag %1 has been assigned to you", "post-awaiting-review": "Post awaiting review", + "topic-awaiting-review": "Topic awaiting review", "profile-exported": "%1 profile exported, click to download", "posts-exported": "%1 posts exported, click to download", "uploads-exported": "%1 uploads exported, click to download", diff --git a/src/notifications.js b/src/notifications.js index c22d050a87..e52be01609 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -329,7 +329,7 @@ async function sendEmail({ uids, notification }, cacheKey, reason) { if (['new-reply', 'new-chat'].includes(notification.type)) { notification['cta-type'] = notification.type; } - let body = notification.bodyLong || ''; + let body = notification.bodyEmail || notification.bodyLong || ''; if (meta.config.removeEmailNotificationImages) { body = body.replace(/]*>/, ''); } diff --git a/src/posts/queue.js b/src/posts/queue.js index 6aca0d781c..4138ed29ef 100644 --- a/src/posts/queue.js +++ b/src/posts/queue.js @@ -201,14 +201,19 @@ module.exports = function (Posts) { await plugins.hooks.fire('action:post-queue.save', payload); const cid = await getCid(type, data); const uids = await getNotificationUids(cid); - const bodyLong = await parseBodyLong(cid, type, data); + const bodyEmail = await parseBodyEmail(cid, type, data); const notifObj = await notifications.create({ type: 'post-queue', nid: `post-queue-${id}`, - mergeId: 'post-queue', - bodyShort: '[[notifications:post-awaiting-review]]', - bodyLong: bodyLong, + mergeId: `post-queue-${type}-uid-${data.uid}`, + bodyShort: type === 'reply' ? + '[[notifications:post-awaiting-review]]' : + '[[notifications:topic-awaiting-review]]', + bodyLong: type === 'reply' ? + await plugins.hooks.fire('filter:parse.raw', data.content) : + validator.escape(String(data.title)), + bodyEmail: bodyEmail, path: `/post-queue/${id}`, from: data.uid, }); @@ -221,7 +226,7 @@ module.exports = function (Posts) { }; }; - async function parseBodyLong(cid, type, data) { + async function parseBodyEmail(cid, type, data) { const url = nconf.get('url'); const [content, category, userData] = await Promise.all([ plugins.hooks.fire('filter:parse.raw', data.content),