mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-17 11:32:16 +00:00
chat: use _id instead of id when finding doc (#10278)
This commit is contained in:
parent
b10f056a73
commit
46d6590fec
2 changed files with 4 additions and 4 deletions
|
|
@ -235,7 +235,7 @@ api.likeChat = {
|
|||
let group = await Group.getGroup({user, groupId});
|
||||
if (!group) throw new NotFound(res.t('groupNotFound'));
|
||||
|
||||
let message = await Chat.findOne({id: req.params.chatId}).exec();
|
||||
let message = await Chat.findOne({_id: req.params.chatId}).exec();
|
||||
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
||||
// @TODO correct this error type
|
||||
if (message.uuid === user._id) throw new NotFound(res.t('messageGroupChatLikeOwnMessage'));
|
||||
|
|
@ -330,7 +330,7 @@ api.clearChatFlags = {
|
|||
});
|
||||
if (!group) throw new NotFound(res.t('groupNotFound'));
|
||||
|
||||
let message = await Chat.findOne({id: chatId}).exec();
|
||||
let message = await Chat.findOne({_id: chatId}).exec();
|
||||
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
||||
|
||||
message.flagCount = 0;
|
||||
|
|
@ -458,7 +458,7 @@ api.deleteChat = {
|
|||
let group = await Group.getGroup({user, groupId, fields: 'chat'});
|
||||
if (!group) throw new NotFound(res.t('groupNotFound'));
|
||||
|
||||
let message = await Chat.findOne({id: chatId}).exec();
|
||||
let message = await Chat.findOne({_id: chatId}).exec();
|
||||
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
||||
|
||||
if (user._id !== message.uuid && !user.contributor.admin) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export default class GroupChatReporter extends ChatReporter {
|
|||
});
|
||||
if (!group) throw new NotFound(this.res.t('groupNotFound'));
|
||||
|
||||
const message = await Chat.findOne({id: this.req.params.chatId}).exec();
|
||||
const message = await Chat.findOne({_id: this.req.params.chatId}).exec();
|
||||
if (!message) throw new NotFound(this.res.t('messageGroupChatNotFound'));
|
||||
if (message.uuid === 'system') throw new BadRequest(this.res.t('messageCannotFlagSystemMessages', {communityManagerEmail: COMMUNITY_MANAGER_EMAIL}));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue