mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 00:56:13 +01:00
fix: #9389, allow admins to add themselves to private groups
This commit is contained in:
@@ -98,7 +98,7 @@ groupsAPI.join = async function (caller, data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSelf && groupData.private && groupData.disableJoinRequests) {
|
if (!isCallerAdmin && isSelf && groupData.private && groupData.disableJoinRequests) {
|
||||||
throw new Error('[[error:group-join-disabled]]');
|
throw new Error('[[error:group-join-disabled]]');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -723,6 +723,12 @@ describe('Groups', () => {
|
|||||||
}
|
}
|
||||||
meta.config.allowPrivateGroups = oldValue;
|
meta.config.allowPrivateGroups = oldValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow admins to join private groups', async () => {
|
||||||
|
const groupsAPI = require('../src/api/groups');
|
||||||
|
await groupsAPI.join({ uid: adminUid }, { uid: adminUid, slug: 'global-moderators' });
|
||||||
|
assert(await Groups.isMember(adminUid, 'Global Moderators'));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('.leave()', () => {
|
describe('.leave()', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user