Added group toJSON conversion and fixed syntax errors

This commit is contained in:
Keith Holliday
2016-01-23 13:41:51 -06:00
parent febc48cd41
commit 2063070f18
2 changed files with 2 additions and 3 deletions

View File

@@ -80,9 +80,7 @@ export class ApiGroup extends ApiObject {
let update = { chat }; let update = { chat };
this.update(update, '$push'); return await this.update(update);
return this;
} }
} }

View File

@@ -153,6 +153,7 @@ api.getGroup = {
if (!group) throw new NotFound(res.t('groupNotFound')); if (!group) throw new NotFound(res.t('groupNotFound'));
if (!user.contributor.admin) { if (!user.contributor.admin) {
group = group.toJSON();
_.remove(group.chat, function removeChat (chat) { _.remove(group.chat, function removeChat (chat) {
chat.flags = {}; chat.flags = {};
return chat.flagCount >= 2; return chat.flagCount >= 2;