Skip to content

Commit

Permalink
fix: Fixed 'chat.new_message' event on receive replied @lid msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Oct 24, 2024
1 parent 6ada707 commit 2a40d01
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/chat/events/registerNewMessageEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -74,10 +75,20 @@ async function addAttributesMsg(msg: any): Promise<MsgModel> {
* @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,
},
});
Expand Down

0 comments on commit 2a40d01

Please sign in to comment.