From f9ff7cc92f21a3cc44dd2eae433b63af2dde2224 Mon Sep 17 00:00:00 2001 From: Felicio Mununga Date: Fri, 17 Jun 2022 14:02:40 +0200 Subject: [PATCH] remove success flag from message handler --- .../client/community/handle-waku-message.ts | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/packages/status-js/src/client/community/handle-waku-message.ts b/packages/status-js/src/client/community/handle-waku-message.ts index 3fcae8c1..16505955 100644 --- a/packages/status-js/src/client/community/handle-waku-message.ts +++ b/packages/status-js/src/client/community/handle-waku-message.ts @@ -66,7 +66,7 @@ export function handleWakuMessage( return } - let success = false + client.wakuMessages.add(messageId) // decode, map and handle (events) try { @@ -78,8 +78,6 @@ export function handleWakuMessage( // handle (state and callback) community.handleDescription(decodedPayload) - success = true - break } @@ -99,8 +97,6 @@ export function handleWakuMessage( // handle community.chats.get(chatUuid)?.handleNewMessage(chatMessage) - success = true - break } @@ -114,8 +110,6 @@ export function handleWakuMessage( .get(chatUuid) ?.handleEditedMessage(messageId, decodedPayload.text) - success = true - break } @@ -127,8 +121,6 @@ export function handleWakuMessage( community.chats.get(chatUuid)?.handleDeletedMessage(messageId) - success = true - break } @@ -142,8 +134,6 @@ export function handleWakuMessage( .get(chatUuid) ?.handlePinnedMessage(messageId, decodedPayload.pinned) - success = true - break } @@ -161,23 +151,15 @@ export function handleWakuMessage( `0x${bytesToHex(publicKey)}` ) - success = true - break } default: - success = true - break } } catch { // protons-runtime throws when trying to decode invalid protocol buffers - success = true - } - - if (success) { - client.wakuMessages.add(messageId) + // eslint-disable-next-line no-empty } return