From a0520ddb3f62db3fecf26cc4a29d9e8321ff435d Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Mon, 5 Feb 2024 17:22:47 -0600 Subject: [PATCH] fix(api): close lingering deprecated APIs --- website/server/controllers/api-v3/chat.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/website/server/controllers/api-v3/chat.js b/website/server/controllers/api-v3/chat.js index cef8f8c185..f99591bfb2 100644 --- a/website/server/controllers/api-v3/chat.js +++ b/website/server/controllers/api-v3/chat.js @@ -82,7 +82,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); @@ -294,6 +297,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, groupId: group._id }).exec(); if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));