improve group invitation code and tests

This commit is contained in:
Alys
2016-03-02 09:26:55 +10:00
parent 2516eae8d3
commit f69a29c152
2 changed files with 92 additions and 0 deletions
+3
View File
@@ -690,6 +690,9 @@ var inviteByEmails = function(invites, group, req, res, next){
api.invite = function(req, res, next){
var group = res.locals.group;
if (group.privacy === 'private' && !_.contains(group.members,res.locals.user._id)) {
return res.json(401, {err: "Only a member can invite new members!"});
}
if (req.body.uuids) {
inviteByUUIDs(req.body.uuids, group, req, res, next);
} else if (req.body.emails) {