fix: clear category cache on copy parent

This commit is contained in:
Barış Soner Uşaklı
2021-02-10 22:13:35 -05:00
parent ed3e9ce2e2
commit 765db86d4e

View File

@@ -141,7 +141,12 @@ module.exports = function (Categories) {
if (copyParent && newParent !== parseInt(toCid, 10)) {
await db.sortedSetRemove(`cid:${oldParent}:children`, toCid);
await db.sortedSetAdd(`cid:${newParent}:children`, source.order, toCid);
cache.del([`cid:${oldParent}:children`, `cid:${newParent}:children`]);
cache.del([
`cid:${oldParent}:children`,
`cid:${oldParent}:children:all`,
`cid:${newParent}:children`,
`cid:${newParent}:children:all`,
]);
}
destination.description = source.description;