mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 09:36:16 +01:00
feat: option to restrict group leaving, closes #7770
This commit is contained in:
@@ -43,7 +43,7 @@ SocketGroups.join = async (socket, data) => {
|
||||
});
|
||||
|
||||
if (results.groupData.private && results.groupData.disableJoinRequests) {
|
||||
throw new Error('[[error:join-requests-disabled]]');
|
||||
throw new Error('[[error:group-join-disabled]]');
|
||||
}
|
||||
|
||||
if (!results.groupData.private || results.isAdmin) {
|
||||
@@ -68,6 +68,11 @@ SocketGroups.leave = async (socket, data) => {
|
||||
throw new Error('[[error:cant-remove-self-as-admin]]');
|
||||
}
|
||||
|
||||
const groupData = await groups.getGroupData(data.groupName);
|
||||
if (groupData.disableLeave) {
|
||||
throw new Error('[[error:group-leave-disabled]]');
|
||||
}
|
||||
|
||||
await groups.leave(data.groupName, socket.uid);
|
||||
logGroupEvent(socket, 'group-leave', {
|
||||
groupName: data.groupName,
|
||||
|
||||
Reference in New Issue
Block a user