mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
fix(groups): fix TypeError when missing
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user