fix(groups): fix TypeError when missing

This commit is contained in:
Sabe Jones
2024-02-05 18:06:18 -06:00
committed by Phillip Thelen
parent a0520ddb3f
commit ec6bb3ae79

View File

@@ -83,10 +83,10 @@ api.getChat = {
const { groupId } = req.params;
const group = await Group.getGroup({ user, groupId, fields: 'chat privacy' });
if (!group) throw new NotFound(res.t('groupNotFound'));
if (group.privacy === 'public') {
throw new BadRequest(res.t('featureRetired'));
}
if (!group) throw new NotFound(res.t('groupNotFound'));
const groupChat = await Group.toJSONCleanChat(group, user);
res.respond(200, groupChat.chat);