diff --git a/website/server/controllers/api-v3/chat.js b/website/server/controllers/api-v3/chat.js index 30729daa98..ca6e66de0b 100644 --- a/website/server/controllers/api-v3/chat.js +++ b/website/server/controllers/api-v3/chat.js @@ -75,10 +75,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);