Skip to content

Node.js based forum software built for the modern web

fix: order of operations when updating category handle

Julian Lam5cfec5b1a900
diff --git a/src/categories/update.js b/src/categories/update.js
index bf32317ae2..ff4d6e4d11 100644
--- a/src/categories/update.js
+++ b/src/categories/update.js
@@ -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),
]);
}