mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
fix(api): close lingering deprecated APIs
This commit is contained in:
parent
f74160c16a
commit
753f12979e
2 changed files with 8 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -8,7 +8,7 @@ i18n_cache
|
||||||
apidoc/html
|
apidoc/html
|
||||||
*.swp
|
*.swp
|
||||||
.idea*
|
.idea*
|
||||||
config.json
|
config*.json
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
lib
|
lib
|
||||||
newrelic_agent.log
|
newrelic_agent.log
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,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);
|
||||||
|
|
@ -249,6 +252,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 }).exec();
|
const message = await Chat.findOne({ _id: req.params.chatId }).exec();
|
||||||
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue