From 2ac11ab0947451e1ccc5e9279fa34e4e793f36fc Mon Sep 17 00:00:00 2001 From: Felicio Mununga Date: Thu, 9 Jun 2022 18:48:27 +0200 Subject: [PATCH] ignore already received chat messages --- .../status-js/src/client/community/community.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/status-js/src/client/community/community.ts b/packages/status-js/src/client/community/community.ts index d4b95fdb..b3950bf9 100644 --- a/packages/status-js/src/client/community/community.ts +++ b/packages/status-js/src/client/community/community.ts @@ -223,11 +223,11 @@ export class Community { while (messageIndex > 0) { const _message = _messages[messageIndex - 1] - // if (_message.messageId === chatMessage.messageId) { - // messageIndex = -1 + if (_message.messageId === chatMessage.messageId) { + messageIndex = -1 - // break - // } + break + } if ( new Date(Number(_message.timestamp)) <= @@ -239,10 +239,10 @@ export class Community { messageIndex-- } - // // already received - // if (messageIndex < 0) { - // return - // } + // already received + if (messageIndex < 0) { + return + } // replied let responsedToMessageIndex = _messages.length