Merge pull request #6563 from TheHollidayInn/api-v3-get-group-tests

Added initial get group tests
This commit is contained in:
Matteo Pagliazzi
2016-01-24 12:12:28 +01:00
4 changed files with 338 additions and 3 deletions
+8
View File
@@ -152,6 +152,14 @@ api.getGroup = {
let group = await Group.getGroup({user, groupId: req.params.groupId, populateLeader: true});
if (!group) throw new NotFound(res.t('groupNotFound'));
if (!user.contributor.admin) {
group = group.toJSON();
_.remove(group.chat, function removeChat (chat) {
chat.flags = {};
return chat.flagCount >= 2;
});
}
res.respond(200, group);
},
};