From b2973fd8a1287f0dc803161a6702f95685fa42d0 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 29 Dec 2025 15:08:04 -0500 Subject: [PATCH] fix: update category sync logic to utilise crossposts instead --- src/activitypub/inbox.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js index 91e9bfab4a..f3413f3f51 100644 --- a/src/activitypub/inbox.js +++ b/src/activitypub/inbox.js @@ -388,12 +388,10 @@ inbox.announce = async (req) => { // Category sync, remove when cross-posting available const { cids } = await activitypub.actors.getLocalFollowers(actor); - let cid = null; - if (cids.size > 0) { - cid = Array.from(cids)[0]; - } + const syncedCids = Array.from(cids); // 1b12 announce + let cid = null; const categoryActor = await categories.exists(actor); if (categoryActor) { cid = actor; @@ -448,7 +446,7 @@ inbox.announce = async (req) => { socketHelpers.sendNotificationToPostOwner(pid, actor, 'announce', 'notifications:activitypub.announce'); } else { // Remote object // Follower check - if (!fromRelay && !cid) { + if (!fromRelay && !cid && !syncedCids.length) { const { followers } = await activitypub.actors.getLocalFollowCounts(actor); if (!followers) { winston.verbose(`[activitypub/inbox.announce] Rejecting ${object.id} via ${actor} due to no followers`); @@ -471,6 +469,12 @@ inbox.announce = async (req) => { ({ tid } = assertion); await activitypub.notes.updateLocalRecipients(pid, { to, cc }); await activitypub.notes.syncUserInboxes(tid); + + if (syncedCids) { + await Promise.all(syncedCids.map(async (cid) => { + await topics.crossposts.add(tid, cid, 0); + })); + } } if (!cid) { // Topic events from actors followed by users only