You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nodebb/src/upgrades/1.10.0/view_deleted_privilege.js

28 lines
785 B
JavaScript

'use strict';
var async = require('async');
var groups = require('../../groups');
var db = require('../../database');
module.exports = {
name: 'Give deleted post viewing privilege to moderators on all categories',
timestamp: Date.UTC(2018, 5, 8),
method: function (callback) {
db.getSortedSetRange('categories:cid', 0, -1, function (err, cids) {
if (err) {
return callback(err);
}
async.eachSeries(cids, function (cid, next) {
async.waterfall([
async.apply(db.getSortedSetRange.bind(db), 'group:cid:' + cid + ':privileges:moderate:members', 0, -1),
function (uids, next) {
async.eachSeries(uids, (uid, next) => groups.join('cid:' + cid + ':privileges:posts:view_deleted', uid, next), next);
},
], next);
}, callback);
});
},
};