wrapping up basic blocking UCP for #6463

This commit is contained in:
Julian Lam
2018-04-27 15:37:00 -04:00
parent 8db98b5cf4
commit 4bac78a568
3 changed files with 37 additions and 2 deletions

View File

@@ -200,4 +200,13 @@ module.exports = function (SocketUser) {
},
], callback);
};
SocketUser.toggleBlock = function (socket, data, callback) {
async.waterfall([
async.apply(user.blocks.is, data.uid, socket.uid),
function (is, next) {
user.blocks[is ? 'remove' : 'add'](data.uid, socket.uid, next);
},
], callback);
};
};