From 9918389a43eacc16679db70e04a8aca119b35128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 29 Oct 2018 10:59:22 -0400 Subject: [PATCH] closes #6884 --- src/categories/create.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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) {