isekai-main
Barış Soner Uşaklı 3 years ago
parent 31cbff19ed
commit 5694e62e59

@ -22,16 +22,17 @@ module.exports = function (Categories) {
await topics.purgePostsAndTopic(tid, uid); await topics.purgePostsAndTopic(tid, uid);
}); });
const categoryData = await Categories.getCategoryData(cid); const categoryData = await Categories.getCategoryData(cid);
await purgeCategory(categoryData); await purgeCategory(cid, categoryData);
plugins.hooks.fire('action:category.delete', { cid: cid, uid: uid, category: categoryData }); plugins.hooks.fire('action:category.delete', { cid: cid, uid: uid, category: categoryData });
}; };
async function purgeCategory(categoryData) { async function purgeCategory(cid, categoryData) {
const { cid } = categoryData; const bulkRemove = [['categories:cid', cid]];
await db.sortedSetRemoveBulk([ if (categoryData && categoryData.name) {
['categories:cid', cid], bulkRemove.push(['categories:name', `${categoryData.name.substr(0, 200).toLowerCase()}:${cid}`]);
['categories:name', `${categoryData.name.substr(0, 200).toLowerCase()}:${cid}`], }
]); await db.sortedSetRemoveBulk(bulkRemove);
await removeFromParent(cid); await removeFromParent(cid);
await deleteTags(cid); await deleteTags(cid);
await db.deleteAll([ await db.deleteAll([

Loading…
Cancel
Save