fix: use setsAdd

This commit is contained in:
Julian Lam
2025-12-03 14:47:10 -05:00
parent 4a6dcf1a21
commit d8e55d58de
2 changed files with 4 additions and 5 deletions

View File

@@ -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;

View File

@@ -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);
});