Node.js based forum software built for the modern web
feat: native image appending for remote private notes
Julian Lam822f4edc4cd1
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.jsindex ff6bad4e6a..46a2caaba6 100644--- a/src/activitypub/mocks.js+++ b/src/activitypub/mocks.js@@ -411,7 +411,10 @@ Mocks.message = async (object) => {mid: object.id,uid: object.attributedTo,content: object.sourceContent || object.content,- // ip: caller.ip,++ _activitypub: {+ attachment: object.attachment,+ },};return message;diff --git a/src/activitypub/notes.js b/src/activitypub/notes.jsindex 650b8c5cb2..9758b1a73d 100644--- a/src/activitypub/notes.js+++ b/src/activitypub/notes.js@@ -339,6 +339,16 @@ Notes.assertPrivate = async (object) => {const payload = await activitypub.mocks.message(object);+ // Naive image appending (using src/posts/attachments.js is likely better, but not worth the effort)+ if (payload._activitypub.hasOwnProperty('attachment')) {+ const images = payload._activitypub.attachment.filter((attachment) => {+ return attachment.mediaType.startsWith('image/');+ }).map(({ url, href }) => url || href);+ images.forEach((url) => {+ payload.content += `<p><img class="img-fluid img-thumbnail" src="${url}" /></p>`;+ });+ }+try {await messaging.checkContent(payload.content, false);} catch (e) {