mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
added methods and socket listeners for group joining and leaving, #2588
This commit is contained in:
23
src/socket.io/groups.js
Normal file
23
src/socket.io/groups.js
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
var groups = require('../groups'),
|
||||
|
||||
SocketGroups = {};
|
||||
|
||||
SocketGroups.join = function(socket, data, callback) {
|
||||
if (!data) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
groups.join(data.groupName, socket.uid, callback);
|
||||
};
|
||||
|
||||
SocketGroups.leave = function(socket, data, callback) {
|
||||
if (!data) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
groups.leave(data.groupName, socket.uid, callback);
|
||||
};
|
||||
|
||||
module.exports = SocketGroups;
|
||||
Reference in New Issue
Block a user