Skip to content

Commit

Permalink
Merge pull request #323 from xmtp/fix/read-receipt-decode
Browse files Browse the repository at this point in the history
fix: readReceipt decode method
  • Loading branch information
nplasterer authored Mar 19, 2024
2 parents 6ea695f + c6fd0bf commit 0826d66
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 0826d66

Please sign in to comment.