From 9e3e56888b062cd1189e6b49a674a733dac8b5a3 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 d4b95fd..b3950bf 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