From f84ddc7a6bf0e60cf8a6af47e25d967306198672 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Fri, 7 Jun 2024 15:58:21 -0500 Subject: [PATCH 1/3] Maybe fix release workflow --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad7c7e45b..879955424 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + persist-credentials: false - name: Setup Node.js uses: actions/setup-node@v4 with: From 98cda57335f992cde1879a1ede78c0fbbc90d633 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Fri, 7 Jun 2024 16:03:33 -0500 Subject: [PATCH 2/3] Add conversation reference to messages --- packages/mls-client/src/Conversation.ts | 4 ++-- packages/mls-client/src/DecodedMessage.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/mls-client/src/Conversation.ts b/packages/mls-client/src/Conversation.ts index 3853b730d..e0bcfe78f 100644 --- a/packages/mls-client/src/Conversation.ts +++ b/packages/mls-client/src/Conversation.ts @@ -80,7 +80,7 @@ export class Conversation { stream() { const asyncStream = new AsyncStream( - (message) => new DecodedMessage(this.#client, message) + (message) => new DecodedMessage(this.#client, this, message) ) const stream = this.#group.stream(asyncStream.callback) asyncStream.stopCallback = stream.end.bind(stream) @@ -126,6 +126,6 @@ export class Conversation { messages(options?: NapiListMessagesOptions): DecodedMessage[] { return this.#group .findMessages(options) - .map((message) => new DecodedMessage(this.#client, message)) + .map((message) => new DecodedMessage(this.#client, this, message)) } } diff --git a/packages/mls-client/src/DecodedMessage.ts b/packages/mls-client/src/DecodedMessage.ts index cc8ee338b..8c788516f 100644 --- a/packages/mls-client/src/DecodedMessage.ts +++ b/packages/mls-client/src/DecodedMessage.ts @@ -5,6 +5,7 @@ import { } from '@xmtp/mls-client-bindings-node' import { ContentTypeId } from '@xmtp/xmtp-js' import type { Client } from '@/Client' +import type { Conversation } from '@/Conversation' import { nsToDate } from '@/helpers/date' export type MessageKind = 'application' | 'membership_change' @@ -14,6 +15,7 @@ export class DecodedMessage { #client: Client content: any contentType: ContentTypeId + conversation: Conversation conversationId: string deliveryStatus: MessageDeliveryStatus fallback?: string @@ -25,8 +27,13 @@ export class DecodedMessage { sentAt: Date sentAtNs: number - constructor(client: Client, message: NapiMessage) { + constructor( + client: Client, + conversation: Conversation, + message: NapiMessage + ) { this.#client = client + this.conversation = conversation this.id = message.id this.sentAtNs = message.sentAtNs this.sentAt = nsToDate(message.sentAtNs) From 632e6a3fe9522c650ac60d9c702ad2040a513624 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Fri, 7 Jun 2024 14:06:12 -0700 Subject: [PATCH 3/3] Create rude-avocados-flow.md --- .changeset/rude-avocados-flow.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/rude-avocados-flow.md diff --git a/.changeset/rude-avocados-flow.md b/.changeset/rude-avocados-flow.md new file mode 100644 index 000000000..cfc45ff84 --- /dev/null +++ b/.changeset/rude-avocados-flow.md @@ -0,0 +1,5 @@ +--- +"@xmtp/mls-client": patch +--- + +Add conversation reference to messages