Node.js based forum software built for the modern web
refactor: add topic-await-review notif text
Barış Soner Uşaklıbac9f1f73ca6
diff --git a/public/language/en-GB/notifications.json b/public/language/en-GB/notifications.jsonindex 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 <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",diff --git a/src/notifications.js b/src/notifications.jsindex 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(/<img[^>]*>/, '');}diff --git a/src/posts/queue.js b/src/posts/queue.jsindex 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),