fix: #9560, don't save post diffs if content didn't change

isekai-main
Barış Soner Uşaklı 3 years ago
parent 1cca8eaddc
commit 8b576a3704

@ -53,8 +53,8 @@ module.exports = function (Posts) {
]); ]);
await Posts.setPostFields(data.pid, result.post); await Posts.setPostFields(data.pid, result.post);
const contentChanged = data.content !== oldContent;
if (meta.config.enablePostHistory === 1) { if (meta.config.enablePostHistory === 1 && contentChanged) {
await Posts.diffs.save({ await Posts.diffs.save({
pid: data.pid, pid: data.pid,
uid: data.uid, uid: data.uid,
@ -72,7 +72,7 @@ module.exports = function (Posts) {
returnPostData.cid = topic.cid; returnPostData.cid = topic.cid;
returnPostData.topic = topic; returnPostData.topic = topic;
returnPostData.editedISO = utils.toISOString(editPostData.edited); returnPostData.editedISO = utils.toISOString(editPostData.edited);
returnPostData.changed = oldContent !== data.content; returnPostData.changed = contentChanged;
await topics.notifyFollowers(returnPostData, data.uid, { await topics.notifyFollowers(returnPostData, data.uid, {
type: 'post-edit', type: 'post-edit',

Loading…
Cancel
Save