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