Skip to content

Commit

Permalink
fix: ensure proper content topics
Browse files Browse the repository at this point in the history
  • Loading branch information
rygine committed Oct 17, 2023
1 parent 170f428 commit 54233a2
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/conversations/Conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class ConversationV1<ContentTypes>
content,
options?.contentType || ContentTypeText,
payload,
topics[0],
this.topic,
this
)
})
Expand Down Expand Up @@ -351,7 +351,7 @@ export class ConversationV1<ContentTypes>
]
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)
Expand All @@ -370,7 +370,7 @@ export class ConversationV1<ContentTypes>
content,
contentType,
payload,
topics[0], // Just use the first topic for the returned value
topic,
this
)
}
Expand Down Expand Up @@ -539,12 +539,7 @@ export class ConversationV2<ContentTypes>
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([
{
Expand All @@ -559,7 +554,7 @@ export class ConversationV2<ContentTypes>
msg,
content,
contentType,
this.topic,
topic,
payload,
this,
this.client.address
Expand Down Expand Up @@ -726,7 +721,7 @@ export class ConversationV2<ContentTypes>
return new PreparedMessage(env, async () => {
await this.client.publishEnvelopes([
{
contentTopic: this.topic,
contentTopic: topic,
message: msgBytes,
timestamp: msg.sent,
},
Expand Down

0 comments on commit 54233a2

Please sign in to comment.