diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000..7646a7f462 Binary files /dev/null and b/dump.rdb differ diff --git a/src/topics/tags.js b/src/topics/tags.js index daab4e5f77..7440e9026e 100644 --- a/src/topics/tags.js +++ b/src/topics/tags.js @@ -17,6 +17,11 @@ const utils = require('../utils'); const batch = require('../batch'); const cache = require('../cache'); +function extractTagValues(tags) { + return tags.map(tagItem => tagItem.value); +} + + module.exports = function (Topics) { Topics.createTags = async function (tags, tid, timestamp) { if (!Array.isArray(tags) || !tags.length) { @@ -158,7 +163,8 @@ module.exports = function (Topics) { // update 'tags' field in topic hash topicData.forEach((topic) => { - topic.tags = topic.tags.map(tagItem => tagItem.value); + topic.tags = extractTagValues(topic.tags); + const index = topic.tags.indexOf(tag); if (index !== -1) { topic.tags.splice(index, 1, newTagName);