mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-14 19:13:29 +02:00
backport private group fixes
This commit is contained in:
@@ -22,6 +22,10 @@ SocketGroups.join = function(socket, data, callback) {
|
||||
return callback(new Error('[[error:invalid-uid]]'));
|
||||
}
|
||||
|
||||
if (data.groupName === 'administrators' || groups.isPrivilegeGroup(data.groupName)) {
|
||||
return callback(new Error('[[error:not-allowed]]'));
|
||||
}
|
||||
|
||||
groups.exists(data.groupName, function(err, exists) {
|
||||
if (err || !exists) {
|
||||
return callback(err || new Error('[[error:no-group]]'));
|
||||
@@ -39,10 +43,10 @@ SocketGroups.join = function(socket, data, callback) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (checks.isPrivate && !checks.isAdmin) {
|
||||
groups.requestMembership(data.groupName, socket.uid, callback);
|
||||
} else {
|
||||
if (!checks.isPrivate || checks.isAdmin) {
|
||||
groups.join(data.groupName, socket.uid, callback);
|
||||
} else {
|
||||
groups.requestMembership(data.groupName, socket.uid, callback);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user