diff --git a/src/conversations/Conversation.ts b/src/conversations/Conversation.ts index 31db3b801..e8acf1839 100644 --- a/src/conversations/Conversation.ts +++ b/src/conversations/Conversation.ts @@ -269,7 +269,7 @@ export class ConversationV1 content, options?.contentType || ContentTypeText, payload, - topics[0], + this.topic, this ) }) @@ -351,7 +351,7 @@ export class ConversationV1 ] this.client.contacts.add(this.peerAddress) } else { - topics = [this.topic] + topics = [topic] } const contentType = options?.contentType || ContentTypeText const payload = await this.client.encodeContent(content, options) @@ -370,7 +370,7 @@ export class ConversationV1 content, contentType, payload, - topics[0], // Just use the first topic for the returned value + topic, this ) } @@ -539,12 +539,7 @@ export class ConversationV2 const payload = await this.client.encodeContent(content, options) const msg = await this.createMessage(payload, options?.timestamp) - let topic: string - if (options?.ephemeral) { - topic = this.ephemeralTopic - } else { - topic = this.topic - } + const topic = options?.ephemeral ? this.ephemeralTopic : this.topic await this.client.publishEnvelopes([ { @@ -559,7 +554,7 @@ export class ConversationV2 msg, content, contentType, - this.topic, + topic, payload, this, this.client.address @@ -726,7 +721,7 @@ export class ConversationV2 return new PreparedMessage(env, async () => { await this.client.publishEnvelopes([ { - contentTopic: this.topic, + contentTopic: topic, message: msgBytes, timestamp: msg.sent, },