Node.js based forum software built for the modern web
fix: don't update edit data if edited timestamp is not available
Julian Lamc5cd76e798c8
diff --git a/public/src/client/topic/events.js b/public/src/client/topic/events.jsindex 7b78bb4b58..60aacd6cf9 100644--- a/public/src/client/topic/events.js+++ b/public/src/client/topic/events.js@@ -142,19 +142,21 @@ define('forum/topic/events', [posts.addBlockquoteEllipses(editedPostEl.parent());editedPostEl.fadeIn(250);- const editData = {- editor: data.editor,- editedISO: utils.toISOString(data.post.edited),- };-- app.parseAndTranslate('partials/topic/post-editor', editData, function (html) {- editorEl.replaceWith(html);- postContainer.find('[component="post/edit-indicator"]')- .removeClass('hidden')- .translateAttr('title', `[[global:edited-timestamp, ${editData.editedISO}]]`);- postContainer.find('[component="post/editor"] .timeago').timeago();- hooks.fire('action:posts.edited', data);- });+ if (data.post.edited) {+ const editData = {+ editor: data.editor,+ editedISO: utils.toISOString(data.post.edited),+ };++ app.parseAndTranslate('partials/topic/post-editor', editData, function (html) {+ editorEl.replaceWith(html);+ postContainer.find('[component="post/edit-indicator"]')+ .removeClass('hidden')+ .translateAttr('title', `[[global:edited-timestamp, ${editData.editedISO}]]`);+ postContainer.find('[component="post/editor"] .timeago').timeago();+ hooks.fire('action:posts.edited', data);+ });+ }});} else {hooks.fire('action:posts.edited', data);