Skip to content

Commit

Permalink
fix: Avoid emit events for 'chat.new_reaction' while is syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Oct 28, 2023
1 parent 7e5d363 commit 61bdffc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/chat/events/registerReactionsEvent.ts
Expand Up @@ -23,12 +23,18 @@ import { createOrUpdateReactions } from '../../whatsapp/functions';

webpack.onFullReady(register);

const now = Date.now();

function register() {
wrapModuleFunction(createOrUpdateReactions, (func, ...args) => {
const [data] = args;

for (const d of data) {
try {
if (d.timestamp < now) {
continue;
}

internalEv.emitAsync('chat.new_reaction', {
id: MsgKey.fromString(d.msgKey),
orphan: d.orphan,
Expand Down

0 comments on commit 61bdffc

Please sign in to comment.