feat: syncUserInboxes to take into account remote topic tags, closes #13074

This commit is contained in:
Julian Lam
2025-02-14 20:43:19 -05:00
parent 182fdf0479
commit 637addc445
2 changed files with 12 additions and 2 deletions

View File

@@ -414,9 +414,9 @@ Notes.getParentChain = async (uid, input) => {
};
Notes.syncUserInboxes = async function (tid, uid) {
const [pids, { cid, mainPid }] = await Promise.all([
const [pids, { cid, mainPid, tags }] = await Promise.all([
db.getSortedSetMembers(`tid:${tid}:posts`),
topics.getTopicFields(tid, ['tid', 'cid', 'mainPid']),
topics.getTopicFields(tid, ['tid', 'cid', 'mainPid', 'tags']),
]);
pids.unshift(mainPid);
@@ -426,6 +426,12 @@ Notes.syncUserInboxes = async function (tid, uid) {
uids.add(parseInt(uid, 10));
}
// Tag followers
const tagsFollowers = await topics.getTagsFollowers(tags.map(tag => tag.value));
new Set(tagsFollowers.flat()).forEach((uid) => {
uids.add(uid);
});
const keys = Array.from(uids).map(uid => `uid:${uid}:inbox`);
const score = await db.sortedSetScore(`cid:${cid}:tids`, tid);