Skip to content

Node.js based forum software built for the modern web

fix: #10692

Barış Soner Uşaklıb6f8e2fd0510
diff --git a/src/topics/tags.js b/src/topics/tags.js
index 7d585771d3..655c18345f 100644
--- a/src/topics/tags.js
+++ b/src/topics/tags.js
@@ -113,6 +113,13 @@ module.exports = function (Topics) {
await db.sortedSetAdd('tags:topic:count', 0, tag);
cache.del('tags:topic:count');
}
+ const allCids = await categories.getAllCidsFromSet('categories:cid');
+ const isMembers = await db.isMemberOfSortedSets(
+ allCids.map(cid => `cid:${cid}:tags`), tag
+ );
+ const bulkAdd = allCids.filter((cid, index) => !isMembers[index])
+ .map(cid => ([`cid:${cid}:tags`, 0, tag]));
+ await db.sortedSetAddBulk(bulkAdd);
};
Topics.renameTags = async function (data) {