mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-21 15:03:12 +01:00
fix: use setsAdd
This commit is contained in:
@@ -401,11 +401,11 @@ Actors.assertGroup = async (ids, options = {}) => {
|
||||
]);
|
||||
|
||||
// Privilege mask
|
||||
const masksAdd = categoryObjs.reduce((queries, category) => {
|
||||
const masksAdd = categoryObjs.reduce((sets, category) => {
|
||||
if (category?._activitypub?.postingRestrictedToMods) {
|
||||
queries.push(db.setAdd.call(db, `cid:${category.cid}:privilegeMask`, 'topics:create'));
|
||||
sets.push(`cid:${category.cid}:privilegeMask`);
|
||||
}
|
||||
return queries;
|
||||
return sets;
|
||||
}, []);
|
||||
|
||||
await Promise.all([
|
||||
@@ -414,7 +414,7 @@ Actors.assertGroup = async (ids, options = {}) => {
|
||||
db.sortedSetAddBulk(queries.searchAdd),
|
||||
db.setObject('handle:cid', queries.handleAdd),
|
||||
_migratePersonToGroup(categoryObjs),
|
||||
Promise.all(masksAdd),
|
||||
db.setsAdd(masksAdd, 'topics:create'),
|
||||
]);
|
||||
|
||||
return categoryObjs;
|
||||
|
||||
@@ -238,7 +238,6 @@ describe('Privilege masking', () => {
|
||||
|
||||
it('should pass the privileges .can() check if requested', async () => {
|
||||
const set = await privileges.categories.get(cid, uid);
|
||||
console.log(set);
|
||||
const can = await privileges.categories.can('topics:create', cid, uid);
|
||||
assert(can);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user