Node.js based forum software built for the modern web
fix: possible fix to escaped emoji in titles
Barış Soner Uşaklıf53245013971
diff --git a/src/topics/tags.js b/src/topics/tags.jsindex 70086a107c..4f2bc6dc97 100644--- a/src/topics/tags.js+++ b/src/topics/tags.js@@ -594,9 +594,10 @@ module.exports = function (Topics) {}tags = tags.map(tag => tag.value);- const [followersOfPoster, allFollowers] = await Promise.all([+ const [followersOfPoster, allFollowers, title] = await Promise.all([db.getSortedSetRange(`followers:${exceptUid}`, 0, -1),db.getSortedSetRange(tags.map(tag => `tag:${tag}:followers`), 0, -1),+ Topics.getTopicField(postData.topic.tid, 'title'),]);const followerSet = new Set(followersOfPoster);// filter out followers of the poster since they get a notification already@@ -609,13 +610,13 @@ module.exports = function (Topics) {const { displayname } = postData.user;const notifBase = 'notifications:user-posted-topic-with-tag';- let bodyShort = translator.compile(notifBase, displayname, postData.topic.title, tags[0]);+ let bodyShort = translator.compile(notifBase, displayname, title, tags[0]);if (tags.length === 2) {- bodyShort = translator.compile(`${notifBase}-dual`, displayname, postData.topic.title, tags[0], tags[1]);+ bodyShort = translator.compile(`${notifBase}-dual`, displayname, title, tags[0], tags[1]);} else if (tags.length === 3) {- bodyShort = translator.compile(`${notifBase}-triple`, displayname, postData.topic.title, tags[0], tags[1], tags[2]);+ bodyShort = translator.compile(`${notifBase}-triple`, displayname, title, tags[0], tags[1], tags[2]);} else if (tags.length > 3) {- bodyShort = translator.compile(`${notifBase}-multiple`, displayname, postData.topic.title, tags.join(', '));+ bodyShort = translator.compile(`${notifBase}-multiple`, displayname, title, tags.join(', '));}const notification = await notifications.create({diff --git a/src/user/notifications.js b/src/user/notifications.jsindex a1d4e7141d..d5d695efb1 100644--- a/src/user/notifications.js+++ b/src/user/notifications.js@@ -10,6 +10,7 @@ const notifications = require('../notifications');const privileges = require('../privileges');const plugins = require('../plugins');const translator = require('../translator');+const topics = require('../topics');const user = require('./index');const utils = require('../utils');@@ -201,15 +202,18 @@ UserNotifications.deleteAll = async function (uid) {UserNotifications.sendTopicNotificationToFollowers = async function (uid, topicData, postData) {try {- let followers = await db.getSortedSetRange(`followers:${uid}`, 0, -1);- followers = await privileges.categories.filterUids('read', topicData.cid, followers);+ const [allFollowers, title] = await Promise.all([+ db.getSortedSetRange(`followers:${uid}`, 0, -1),+ topics.getTopicField(topicData.tid, 'title'),+ ]);+ const followers = await privileges.categories.filterUids('read', topicData.cid, allFollowers);if (!followers.length) {return;}const notifObj = await notifications.create({type: 'new-topic',- bodyShort: translator.compile('notifications:user-posted-topic', postData.user.displayname, postData.topic.title),+ bodyShort: translator.compile('notifications:user-posted-topic', postData.user.displayname, title),bodyLong: postData.content,pid: postData.pid,path: `/post/${postData.pid}`,