Skip to content

Commit

Permalink
fix: readReceipt decode method
Browse files Browse the repository at this point in the history
  • Loading branch information
kele-leanes committed Mar 19, 2024
1 parent 6ea695f commit c6fd0bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/DecodedMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ContentTypes = any> {
client: Client<ContentTypes>
id: string
Expand Down Expand Up @@ -100,7 +104,9 @@ export class DecodedMessage<ContentTypes = any> {
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<ContentTypes>).decode(
this.nativeContent
Expand Down

0 comments on commit c6fd0bf

Please sign in to comment.