Node.js based forum software built for the modern web
fix: duplicate logic and double-parsing issue, #12834
Julian Lam8a1abe686c44
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.jsindex f113548af7..5d827d35a4 100644--- a/src/activitypub/mocks.js+++ b/src/activitypub/mocks.js@@ -458,7 +458,6 @@ Mocks.notes.private = async ({ messageObj }) => {const to = new Set(uids);const published = messageObj.timestampISO;const updated = messageObj.edited ? messageObj.editedISO : undefined;- const content = await messaging.parse(messageObj.content, messageObj.fromuid, 0, messageObj.roomId, false);let source;const markdownEnabled = await plugins.isActive('nodebb-plugin-markdown');@@ -499,7 +498,7 @@ Mocks.notes.private = async ({ messageObj }) => {// audience: `${nconf.get('url')}/category/${post.category.cid}`,summary: null,// name,- content: content,+ content: messageObj.content,source,tag,// attachment: [], // tododiff --git a/src/api/activitypub.js b/src/api/activitypub.jsindex 0bcdb5b4ef..21b330416d 100644--- a/src/api/activitypub.js+++ b/src/api/activitypub.js@@ -212,13 +212,7 @@ activitypubApi.create.note = enabledCheck(async (caller, { pid, post }) => {}});-activitypubApi.create.privateNote = enabledCheck(async (caller, { mid, messageObj }) => {- if (!messageObj) {- messageObj = await messaging.getMessageFields(mid, []);- if (!messageObj) {- throw new Error('[[error:invalid-data]]');- }- }+activitypubApi.create.privateNote = enabledCheck(async (caller, { messageObj }) => {const { roomId } = messageObj;let targets = await messaging.getUidsInRoom(roomId, 0, -1);targets = targets.filter(uid => !utils.isNumber(uid)); // remote uids onlydiff --git a/src/controllers/activitypub/actors.js b/src/controllers/activitypub/actors.jsindex 2ffd0f5655..4cde9b333c 100644--- a/src/controllers/activitypub/actors.js+++ b/src/controllers/activitypub/actors.js@@ -193,6 +193,7 @@ Actors.message = async function (req, res, next) {}const messageObj = await messaging.getMessageFields(req.params.mid, []);+ messageObj.content = await messaging.parse(messageObj.content, messageObj.fromuid, 0, messageObj.roomId, false);const payload = await activitypub.mocks.notes.private({ messageObj });res.status(200).json(payload);};