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.
This commit is contained in:
Barış Soner Uşaklı
2026-02-26 16:04:07 -05:00
parent 50f5541ef7
commit bac9f1f73c
3 changed files with 12 additions and 6 deletions

View File

@@ -72,6 +72,7 @@
"new-register-multiple": "There are <strong>%1</strong> registration requests awaiting review.",
"flag-assigned-to-you": "<strong>Flag %1</strong> has been assigned to you",
"post-awaiting-review": "Post awaiting review",
"topic-awaiting-review": "Topic awaiting review",
"profile-exported": "<strong>%1</strong> profile exported, click to download",
"posts-exported": "<strong>%1</strong> posts exported, click to download",
"uploads-exported": "<strong>%1</strong> uploads exported, click to download",

View File

@@ -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(/<img[^>]*>/, '');
}

View File

@@ -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),