mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
fix(groups): fix TypeError when missing
This commit is contained in:
parent
bccfaab350
commit
8b3267458b
1 changed files with 1 additions and 1 deletions
|
|
@ -75,10 +75,10 @@ api.getChat = {
|
||||||
|
|
||||||
const { groupId } = req.params;
|
const { groupId } = req.params;
|
||||||
const group = await Group.getGroup({ user, groupId, fields: 'chat privacy' });
|
const group = await Group.getGroup({ user, groupId, fields: 'chat privacy' });
|
||||||
|
if (!group) throw new NotFound(res.t('groupNotFound'));
|
||||||
if (group.privacy === 'public') {
|
if (group.privacy === 'public') {
|
||||||
throw new BadRequest(res.t('featureRetired'));
|
throw new BadRequest(res.t('featureRetired'));
|
||||||
}
|
}
|
||||||
if (!group) throw new NotFound(res.t('groupNotFound'));
|
|
||||||
|
|
||||||
const groupChat = await Group.toJSONCleanChat(group, user);
|
const groupChat = await Group.toJSONCleanChat(group, user);
|
||||||
res.respond(200, groupChat.chat);
|
res.respond(200, groupChat.chat);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue