From 69c5f94193fae0a127356b9992c526b0362b0116 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 23 Jan 2026 11:35:32 -0500 Subject: [PATCH] fix: proper attachment generation on replies, fixed replies getting thumb attachment when it wasn't part of it --- src/activitypub/mocks.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js index 19a20991c1..7aad23fb6f 100644 --- a/src/activitypub/mocks.js +++ b/src/activitypub/mocks.js @@ -735,12 +735,21 @@ Mocks.notes.public = async (post) => { const plaintext = posts.sanitizePlaintext(content); const isArticle = post.pid === post.topic.mainPid && plaintext.length > 500; - const thumbs = await topics.thumbs.get(post.tid); - thumbs.forEach(({ name, path }) => { - const mediaType = mime.getType(name); - const url = `${nconf.get('url') + nconf.get('upload_url')}${path}`; - attachment.push({ mediaType, url }); - }); + if (post.isMainPost) { + const thumbs = await topics.thumbs.get(post.tid); + thumbs.forEach(({ name, path }) => { + const mediaType = mime.getType(name); + const url = `${nconf.get('url') + nconf.get('upload_url')}${path}`; + attachment.push({ mediaType, url }); + }); + } else { + const uploads = await posts.uploads.listWithSizes(post.pid); + uploads.forEach(({ name, width, height }) => { + const mediaType = mime.getType(name); + const url = `${nconf.get('url') + nconf.get('upload_url')}${name}`; + attachment.push({ mediaType, url, width, height }); + }); + } // Inspect post content for external imagery as well let match = posts.imgRegex.exec(post.content);