fix: no need for moderate bit for global mods and admins

v1.18.x
Barış Soner Uşaklı 6 years ago
parent d202be5b4f
commit 8aef689f05

@ -182,9 +182,11 @@
return states.map(function (priv) { return states.map(function (priv) {
var guestDisabled = ['groups:moderate', 'groups:posts:upvote', 'groups:posts:downvote', 'groups:local:login', 'groups:group:create']; var guestDisabled = ['groups:moderate', 'groups:posts:upvote', 'groups:posts:downvote', 'groups:local:login', 'groups:group:create'];
var spidersEnabled = ['groups:find', 'groups:read', 'groups:topics:read', 'groups:view:users', 'groups:view:tags', 'groups:view:groups']; var spidersEnabled = ['groups:find', 'groups:read', 'groups:topics:read', 'groups:view:users', 'groups:view:tags', 'groups:view:groups'];
var globalModDisabled = ['groups:moderate'];
var disabled = var disabled =
(member === 'guests' && guestDisabled.includes(priv.name)) || (member === 'guests' && guestDisabled.includes(priv.name)) ||
(member === 'spiders' && !spidersEnabled.includes(priv.name)); (member === 'spiders' && !spidersEnabled.includes(priv.name)) ||
(member === 'Global Moderators' && globalModDisabled.includes(priv.name));
return '<td class="text-center" data-privilege="' + priv.name + '"><input type="checkbox"' + (priv.state ? ' checked' : '') + (disabled ? ' disabled="disabled"' : '') + ' /></td>'; return '<td class="text-center" data-privilege="' + priv.name + '"><input type="checkbox"' + (priv.state ? ' checked' : '') + (disabled ? ' disabled="disabled"' : '') + ' /></td>';
}).join(''); }).join('');

@ -71,7 +71,6 @@ module.exports = function (Categories) {
const modPrivileges = defaultPrivileges.concat([ const modPrivileges = defaultPrivileges.concat([
'posts:view_deleted', 'posts:view_deleted',
'purge', 'purge',
'moderate',
]); ]);
async.series([ async.series([

@ -26,7 +26,6 @@ module.exports = {
const modPrivileges = defaultPrivileges.concat([ const modPrivileges = defaultPrivileges.concat([
'posts:view_deleted', 'posts:view_deleted',
'purge', 'purge',
'moderate',
]); ]);
const globalModPrivs = [ const globalModPrivs = [

@ -849,9 +849,9 @@ describe('Categories', function () {
it('should retrieve all users with moderator bit in category privilege', function (done) { it('should retrieve all users with moderator bit in category privilege', function (done) {
Categories.getModeratorUids([1, 2], function (err, uids) { Categories.getModeratorUids([1, 2], function (err, uids) {
assert.ifError(err); assert.ifError(err);
assert.strictEqual(2, uids.length); assert.strictEqual(uids.length, 2);
assert(uids[0].includes('1')); assert(uids[0].includes('1'));
assert.strictEqual(1, uids[1].length); assert.strictEqual(uids[1].length, 0);
done(); done();
}); });
}); });

Loading…
Cancel
Save