From d13980c8fb69d8041961caec7ded5aecec8a316a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 12 Feb 2024 14:51:21 -0500 Subject: [PATCH] fix: take mainPid into account in syncUserInboxes --- src/activitypub/notes.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index 4821c79f2d..7bf9445156 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -219,10 +219,14 @@ Notes.updateTopicCounts = async function (tid) { }; Notes.syncUserInboxes = async function (tid) { - const pids = await db.getSortedSetMembers(`tid:${tid}:posts`); + const [pids, { cid, mainPid }] = await Promise.all([ + db.getSortedSetMembers(`tid:${tid}:posts`), + topics.getTopicFields(tid, ['cid', 'mainPid']), + ]); + pids.unshift(mainPid); + const recipients = await db.getSetsMembers(pids.map(id => `post:${id}:recipients`)); const uids = recipients.reduce((set, uids) => new Set([...set, ...uids.map(u => parseInt(u, 10))]), new Set()); - const cid = await topics.getTopicField(tid, 'cid'); const keys = Array.from(uids).map(uid => `uid:${uid}:inbox`); const score = await db.sortedSetScore(`cid:${cid}:tids`, tid);