diff --git a/src/categories/create.js b/src/categories/create.js index 42fdfed919..9c20522e85 100644 --- a/src/categories/create.js +++ b/src/categories/create.js @@ -176,6 +176,9 @@ module.exports = function (Categories) { async.series(tasks, next); }, function (results, next) { + copyTagWhitelist(fromCid, toCid, next); + }, + function (next) { Categories.copyPrivilegesFrom(fromCid, toCid, next); }, ], function (err) { @@ -183,6 +186,22 @@ module.exports = function (Categories) { }); }; + function copyTagWhitelist(fromCid, toCid, callback) { + var data; + async.waterfall([ + function (next) { + db.getSortedSetRangeWithScores('cid:' + fromCid + ':tag:whitelist', 0, -1, next); + }, + function (_data, next) { + data = _data; + db.delete('cid:' + toCid + ':tag:whitelist', next); + }, + function (next) { + db.sortedSetAdd('cid:' + toCid + ':tag:whitelist', data.map(item => item.score), data.map(item => item.value), next); + }, + ], callback); + } + Categories.copyPrivilegesFrom = function (fromCid, toCid, callback) { async.waterfall([ function (next) {