Node.js based forum software built for the modern web
fix(posts): suppress edit notifications when content unchanged
Julian Lam0acf962d9690
diff --git a/src/api/posts.js b/src/api/posts.jsindex a9affbe2bd..72a909d62e 100644--- a/src/api/posts.js+++ b/src/api/posts.js@@ -146,7 +146,7 @@ postsAPI.edit = async function (caller, data) {const returnData = { ...postObj[0], ...editResult.post };returnData.topic = { ...postObj[0].topic, ...editResult.post.topic };- if (!editResult.post.deleted) {+ if (!editResult.post.deleted && editResult.post.changed) {const topicScheduled = await topics.getTopicField(editResult.topic.tid, 'scheduled');websockets.in(`topic_${editResult.topic.tid}`).emit('event:post_edited', editResult);if (!topicScheduled) {diff --git a/src/posts/edit.js b/src/posts/edit.jsindex 66cfd5cd83..2c17ef5d2d 100644--- a/src/posts/edit.js+++ b/src/posts/edit.js@@ -96,10 +96,12 @@ module.exports = function (Posts) {await Posts.parsePost(returnPostData);- await topics.notifyFollowers(returnPostData, data.uid, {- type: 'post-edit',- nid: `edit_post:${data.pid}:uid:${data.uid}`,- });+ if (contentChanged) {+ await topics.notifyFollowers(returnPostData, data.uid, {+ type: 'post-edit',+ nid: `edit_post:${data.pid}:uid:${data.uid}`,+ });+ }return {topic: topic,