check for membership when leaving public guild, fix memberCount update when leaving group, add missing files

This commit is contained in:
Matteo Pagliazzi
2016-02-28 01:11:45 +01:00
parent 733da70b48
commit 5e68589ac8
6 changed files with 62 additions and 14 deletions
+2 -2
View File
@@ -332,7 +332,7 @@ api.leaveGroup = {
let validationErrors = req.validationErrors();
if (validationErrors) throw validationErrors;
let group = await Group.getGroup({user, groupId: req.params.groupId, fields: '-chat'}); // Do not fetch chat
let group = await Group.getGroup({user, groupId: req.params.groupId, fields: '-chat', requireMembership: true});
if (!group) throw new NotFound(res.t('groupNotFound'));
// During quests, checke wheter user can leave
@@ -590,7 +590,7 @@ api.inviteToGroup = {
let validationErrors = req.validationErrors();
if (validationErrors) throw validationErrors;
let group = await Group.getGroup({user, groupId: req.params.groupId, fields: '-chat'}); // Do not fetch chat TODO other fields too?
let group = await Group.getGroup({user, groupId: req.params.groupId, fields: '-chat'});
if (!group) throw new NotFound(res.t('groupNotFound'));
let uuids = req.body.uuids;