mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: #8982, copy color on tag rename, dont copy if target exists
refresh page on tag rename
This commit is contained in:
@@ -14,5 +14,6 @@
|
||||
|
||||
"alerts.editing": "Editing tag(s)",
|
||||
"alerts.confirm-delete": "Do you want to delete the selected tags?",
|
||||
"alerts.update-success": "Tag Updated!"
|
||||
"alerts.update-success": "Tag Updated!",
|
||||
"reset-colors": "Reset colors"
|
||||
}
|
||||
@@ -159,6 +159,7 @@ define('admin/manage/tags', [
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
app.alertSuccess('[[admin/manage/tags:alerts.update-success]]');
|
||||
ajaxify.refresh();
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -90,6 +90,15 @@ module.exports = function (Topics) {
|
||||
}
|
||||
newTagName = utils.cleanUpTag(newTagName, meta.config.maximumTagLength);
|
||||
await Topics.createEmptyTag(newTagName);
|
||||
const targetExists = await db.isSortedSetMember('tags:topic:count', newTagName);
|
||||
const tagData = await db.getObject('tag:' + tag);
|
||||
if (tagData && !targetExists) {
|
||||
await db.setObject('tag:' + newTagName, {
|
||||
color: tagData.color,
|
||||
bgColor: tagData.bgColor,
|
||||
});
|
||||
}
|
||||
|
||||
await batch.processSortedSet('tag:' + tag + ':topics', async function (tids) {
|
||||
const scores = await db.sortedSetScores('tag:' + tag + ':topics', tids);
|
||||
await db.sortedSetAdd('tag:' + newTagName + ':topics', scores, tids);
|
||||
|
||||
Reference in New Issue
Block a user