Node.js based forum software built for the modern web
fix: re-use already parsed html in api.posts.edit's call to getPostSummaryByPids, delay federating out edit activity for 5s to give link preview a chance to resolve
Julian Lamb04a11055f65
diff --git a/src/api/posts.js b/src/api/posts.jsindex 259fcf6407..e56a4a125b 100644--- a/src/api/posts.js+++ b/src/api/posts.js@@ -143,13 +143,16 @@ postsAPI.edit = async function (caller, data) {newTitle: validator.escape(String(editResult.topic.title)),});}- const postObj = await posts.getPostSummaryByPids([editResult.post.pid], caller.uid, { extraFields: ['edited'] });+ const postObj = await posts.getPostSummaryByPids([editResult.post.pid], caller.uid, { parse: false, extraFields: ['edited'] });+ postObj.content = editResult.post.content; // re-use already parsed htmlconst returnData = { ...postObj[0], ...editResult.post };returnData.topic = { ...postObj[0].topic, ...editResult.post.topic };if (!editResult.post.deleted) {websockets.in(`topic_${editResult.topic.tid}`).emit('event:post_edited', editResult);- await require('.').activitypub.update.note(caller, { post: postObj[0] });+ setTimeout(() => {+ require('.').activitypub.update.note(caller, { post: postObj[0] });+ }, 5000);return returnData;}