From c6fd0bf5383451438b97267e31e5469b76d501fa Mon Sep 17 00:00:00 2001 From: kele-leanes Date: Tue, 19 Mar 2024 17:28:43 -0300 Subject: [PATCH] fix: readReceipt decode method --- src/lib/DecodedMessage.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/DecodedMessage.ts b/src/lib/DecodedMessage.ts index 103e3116c..b5f7b23c2 100644 --- a/src/lib/DecodedMessage.ts +++ b/src/lib/DecodedMessage.ts @@ -9,6 +9,10 @@ import { ReplyCodec } from './NativeCodecs/ReplyCodec' import { TextCodec } from './NativeCodecs/TextCodec' import { Buffer } from 'buffer' +const allowEmptyProperties: (keyof NativeMessageContent)[] = [ + 'text', + 'readReceipt', +] export class DecodedMessage { client: Client id: string @@ -100,7 +104,9 @@ export class DecodedMessage { for (const codec of Object.values(this.client.codecRegistry)) { if ( ('contentKey' in codec && this.nativeContent[codec.contentKey]) || - this.nativeContent.hasOwnProperty('text') + allowEmptyProperties.some((prop) => + this.nativeContent.hasOwnProperty(prop) + ) ) { return (codec as NativeContentCodec).decode( this.nativeContent