mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 02:36:16 +01:00
Category tags (#8938)
* feat: wip category tags * fix: tag search * feat: remove debug * fix: returns of searchTags and autocomplete * fix: alpha sort * fix: redis * fix: delete zsets on category purge, fix another test * fix: test
This commit is contained in:
committed by
GitHub
parent
792e9e703e
commit
d2888d1d1f
@@ -28,6 +28,7 @@ module.exports = function (Categories) {
|
||||
async function purgeCategory(cid) {
|
||||
await db.sortedSetRemove('categories:cid', cid);
|
||||
await removeFromParent(cid);
|
||||
await deleteTags(cid);
|
||||
await db.deleteAll([
|
||||
'cid:' + cid + ':tids',
|
||||
'cid:' + cid + ':tids:pinned',
|
||||
@@ -71,4 +72,10 @@ module.exports = function (Categories) {
|
||||
'cid:' + cid + ':tag:whitelist',
|
||||
]);
|
||||
}
|
||||
|
||||
async function deleteTags(cid) {
|
||||
const tags = await db.getSortedSetMembers('cid:' + cid + ':tags');
|
||||
await db.deleteAll(tags.map(tag => 'cid:' + cid + ':tag:' + tag + ':topics'));
|
||||
await db.delete('cid:' + cid + ':tags');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user