populate group.leader

This commit is contained in:
Matteo Pagliazzi
2016-01-16 15:10:18 +01:00
parent 96c523493a
commit d7d63ad229
6 changed files with 30 additions and 24 deletions

View File

@@ -38,7 +38,7 @@ api.createChallenge = {
let groupId = req.body.groupId;
let prize = req.body.prize;
let group = await Group.getGroup(user, groupId, '-chat');
let group = await Group.getGroup({user, groupId, fields: '-chat'});
if (!group) throw new NotFound(res.t('groupNotFound'));
if (group.leaderOnly && group.leaderOnly.challenges && group.leader !== user._id) {