Skip to content

Node.js based forum software built for the modern web

fix(posts/queue): add crosspost type handling for notifications

Julian Lam5fe9768814bf
diff --git a/src/posts/queue.js b/src/posts/queue.js
index 0fb1e9e233..1c3408da27 100644
--- a/src/posts/queue.js
+++ b/src/posts/queue.js
@@ -249,14 +249,19 @@ module.exports = function (Posts) {
bodyShort = '[[notifications:topic-awaiting-review]]';
}
+ let bodyLong;
+ if (type === 'reply') {
+ bodyLong = await plugins.hooks.fire('filter:parse.raw', data.sourceContent || data.content);
+ } else {
+ bodyLong = validator.escape(String(data.title));
+ }
+
const notifObj = await notifications.create({
type: 'post-queue',
nid: `post-queue-${id}`,
mergeId: `post-queue-${type}-uid-${data.uid}`,
bodyShort,
- bodyLong: type === 'reply' ?
- await plugins.hooks.fire('filter:parse.raw', data.sourceContent || data.content) :
- validator.escape(String(data.title)),
+ bodyLong: bodyLong,
bodyEmail: bodyEmail,
path: `/post-queue/${id}`,
from: data.uid,
diff --git a/src/topics/crossposts.js b/src/topics/crossposts.js
index 1fe99a7edb..238a8947a6 100644
--- a/src/topics/crossposts.js
+++ b/src/topics/crossposts.js
@@ -121,9 +121,11 @@ Crossposts.queue = async function (tid, cid, uid) {
if (!meta.config.postQueue) {
return;
}
+ const title = await topics.getTopicField(tid, 'title');
await posts.addToQueue({
uid: uid || 0,
tid,
+ title,
crosspostCid: cid,
});
};