mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-15 10:16:12 +01:00
feat: update groups.leave to allow global mods to kick users out of groups
This commit is contained in:
@@ -201,10 +201,9 @@ groupsAPI.leave = async function (caller, data) {
|
||||
throw new Error('[[error:cant-remove-self-as-admin]]');
|
||||
}
|
||||
|
||||
const [groupData, isCallerAdmin, isCallerOwner, userExists, isMember] = await Promise.all([
|
||||
const [groupData, isCallerOwner, userExists, isMember] = await Promise.all([
|
||||
groups.getGroupData(groupName),
|
||||
user.isAdministrator(caller.uid),
|
||||
groups.ownership.isOwner(caller.uid, groupName),
|
||||
isOwner(caller, groupName, false),
|
||||
user.exists(data.uid),
|
||||
groups.isMember(data.uid, groupName),
|
||||
]);
|
||||
@@ -221,7 +220,7 @@ groupsAPI.leave = async function (caller, data) {
|
||||
throw new Error('[[error:group-leave-disabled]]');
|
||||
}
|
||||
|
||||
if (isSelf || isCallerAdmin || isCallerOwner) {
|
||||
if (isSelf || isCallerOwner) {
|
||||
await groups.leave(groupName, data.uid);
|
||||
} else {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
|
||||
Reference in New Issue
Block a user