mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +01:00
feat: syncUserInboxes to take into account remote topic tags, closes #13074
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user