mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
fix(api): close lingering deprecated APIs
This commit is contained in:
committed by
Phillip Thelen
parent
e89bf3e588
commit
a0520ddb3f
@@ -82,7 +82,10 @@ api.getChat = {
|
|||||||
if (validationErrors) throw validationErrors;
|
if (validationErrors) throw validationErrors;
|
||||||
|
|
||||||
const { groupId } = req.params;
|
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'));
|
if (!group) throw new NotFound(res.t('groupNotFound'));
|
||||||
|
|
||||||
const groupChat = await Group.toJSONCleanChat(group, user);
|
const groupChat = await Group.toJSONCleanChat(group, user);
|
||||||
@@ -294,6 +297,9 @@ api.likeChat = {
|
|||||||
|
|
||||||
const group = await Group.getGroup({ user, groupId });
|
const group = await Group.getGroup({ user, groupId });
|
||||||
if (!group) throw new NotFound(res.t('groupNotFound'));
|
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();
|
const message = await Chat.findOne({ _id: req.params.chatId, groupId: group._id }).exec();
|
||||||
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
||||||
|
|||||||
Reference in New Issue
Block a user