fix: order of operations when updating category handle

This commit is contained in:
Julian Lam
2025-10-28 11:51:02 -04:00
parent 07eb16150c
commit 5cfec5b1a9

View File

@@ -165,9 +165,9 @@ module.exports = function (Categories) {
throw new Error('[[error:category.handle-taken]]');
}
await db.sortedSetRemove('categoryhandle:cid', existing);
await Promise.all([
db.setObjectField(`category:${cid}`, 'handle', handle),
db.sortedSetRemove('categoryhandle:cid', existing),
db.sortedSetAdd('categoryhandle:cid', cid, handle),
]);
}