mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 02:25:55 +01:00
hooking up accept/reject invite, #2758
This commit is contained in:
@@ -101,6 +101,34 @@ SocketGroups.reject = function(socket, data, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
SocketGroups.acceptInvite = function(socket, data, callback) {
|
||||
if (!data) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
groups.isInvited(socket.uid, data.groupName, function(err, invited) {
|
||||
if (!invited) {
|
||||
return callback(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
|
||||
groups.acceptMembership(data.groupName, socket.uid, callback);
|
||||
});
|
||||
};
|
||||
|
||||
SocketGroups.rejectInvite = function(socket, data, callback) {
|
||||
if (!data) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
groups.isInvited(socket.uid, data.groupName, function(err, invited) {
|
||||
if (!invited) {
|
||||
return callback(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
|
||||
groups.rejectMembership(data.groupName, socket.uid, callback);
|
||||
});
|
||||
};
|
||||
|
||||
SocketGroups.update = function(socket, data, callback) {
|
||||
if (!data) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
|
||||
Reference in New Issue
Block a user