remove success flag from message handler

This commit is contained in:
Felicio Mununga 2022-06-17 14:02:40 +02:00
parent b4d5cbb9cd
commit f9ff7cc92f
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
1 changed files with 2 additions and 20 deletions

View File

@ -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