From d0c058263f5ffbdd7be821d15b3fd3bcbdb5fa12 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 22 Sep 2025 12:14:14 -0400 Subject: [PATCH] fix: update note assertion topic members check to simpler posts.exists check The original logic checked that each member of the resolved chain was part of the resolved topic. That isn't always the case, especially when topics splinter due to network timeouts/unavailability. This ended up causing issues where already asserted posts were re-asserted but failed because they no longer served an _activitypub object since it was already asserted and the data was just pulled from the db. --- src/activitypub/notes.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index 832b8d152d..e1fc16c175 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -117,9 +117,8 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { await topics.tools.move(tid, { cid: options.cid, uid: 'system' }); } - const members = await db.isSortedSetMembers(`tid:${tid}:posts`, chain.slice(1).map(p => p.pid)); - members.unshift(await posts.exists(mainPid)); - if (tid && members.every(Boolean)) { + const exists = await posts.exists(chain.map(p => p.pid)); + if (tid && exists.every(Boolean)) { // All cached, return early. activitypub.helpers.log('[notes/assert] No new notes to process.'); await unlock(id); @@ -212,7 +211,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { } return post; - }).filter((p, idx) => !members[idx]); + }).filter((p, idx) => !exists[idx]); const count = unprocessed.length; activitypub.helpers.log(`[notes/assert] ${count} new note(s) found.`);