diff --git a/.gitignore b/.gitignore index f3ead07d99..281f70746f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ i18n_cache apidoc/html *.swp .idea* -config.json +config*.json npm-debug.log* lib newrelic_agent.log diff --git a/website/server/controllers/api-v3/chat.js b/website/server/controllers/api-v3/chat.js index 60a6001ed1..30729daa98 100644 --- a/website/server/controllers/api-v3/chat.js +++ b/website/server/controllers/api-v3/chat.js @@ -74,7 +74,10 @@ api.getChat = { if (validationErrors) throw validationErrors; const { groupId } = req.params; - const group = await Group.getGroup({ user, groupId, fields: 'chat' }); + const group = await Group.getGroup({ user, groupId, fields: 'chat privacy' }); + 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); @@ -249,6 +252,9 @@ api.likeChat = { const group = await Group.getGroup({ user, groupId }); if (!group) throw new NotFound(res.t('groupNotFound')); + if (group.privacy === 'public') { + throw new BadRequest(res.t('featureRetired')); + } const message = await Chat.findOne({ _id: req.params.chatId }).exec(); if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));