diff --git a/src/chat/events/registerNewMessageEvent.ts b/src/chat/events/registerNewMessageEvent.ts index ea3d1b6239..c7e2549b0b 100644 --- a/src/chat/events/registerNewMessageEvent.ts +++ b/src/chat/events/registerNewMessageEvent.ts @@ -17,7 +17,8 @@ import { internalEv } from '../../eventEmitter'; import * as webpack from '../../webpack'; import { ChatStore, MsgModel, MsgStore } from '../../whatsapp'; -import { getQuotedMsg, getQuotedMsgKey } from '../functions/'; +import { getQuotedMsgObj } from '../../whatsapp/functions'; +import { getQuotedMsgKey } from '../functions/'; webpack.onInjected(() => register()); @@ -74,10 +75,20 @@ async function addAttributesMsg(msg: any): Promise { * @todo, remove this */ if (!(typeof msg.quotedStanzaID === 'undefined')) { - const replyMsg = await getQuotedMsg(msg.id); + const quotedMsg = getQuotedMsgObj(msg); + if (!quotedMsg) return msg; Object.defineProperties(msg, { _quotedMsgObj: { - value: replyMsg, + value: quotedMsg, + writable: false, + }, + quotedMsgObj: { + value: quotedMsg, + writable: false, + }, + // Fixed quotedMsgId when receive messages from @lid + quotedMsgId: { + value: quotedMsg.id, writable: false, }, });