Skip to content

Commit

Permalink
Fixes the default name of direct conversations (#114)
Browse files Browse the repository at this point in the history
The conversation name was missing a "." (dot).
  • Loading branch information
wkal-pubnub authored Nov 6, 2024
1 parent ae5063c commit b706dfa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ class ChatImpl(
): PNFuture<CreateDirectConversationResult> {
val user = this.currentUser
val sortedUsers = listOf(invitedUser.id, user.id).sorted()
val finalChannelId = channelId ?: "direct${cyrb53a("${sortedUsers[0]}&${sortedUsers[1]}")}"
val finalChannelId = channelId ?: "direct.${cyrb53a("${sortedUsers[0]}&${sortedUsers[1]}")}"

return getChannel(finalChannelId).thenAsync { channel ->
channel?.asFuture() ?: createChannel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,19 @@ class ChannelIntegrationTest : BaseChatIntegrationTest() {
@Test
fun streamPresence() = runTest {
val completable = CompletableDeferred<Collection<String>>()
val closeable = channel01.connect {}

channel01.streamPresence {
if (it.isNotEmpty()) {
completable.complete(it)
pubnub.test(backgroundScope, checkAllEvents = false) {
var closeable: AutoCloseable? = null
pubnub.awaitSubscribe(listOf(channel01.id)) {
channel01.streamPresence {
if (it.isNotEmpty()) {
completable.complete(it)
}
}
closeable = channel01.connect {}
}
assertEquals(setOf(someUser.id), completable.await())
closeable?.close()
}

assertEquals(setOf(someUser.id), completable.await())
closeable.close()
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ChatIntegrationTest : BaseChatIntegrationTest() {

// then
val sortedUsers = listOf(chat.currentUser.id, someUser.id).sorted()
assertEquals("direct${cyrb53a("${sortedUsers[0]}&${sortedUsers[1]}")}", result.channel.id)
assertEquals("direct.${cyrb53a("${sortedUsers[0]}&${sortedUsers[1]}")}", result.channel.id)

assertEquals(
chat.currentUser.asImpl().copy(updated = null, lastActiveTimestamp = null),
Expand Down

0 comments on commit b706dfa

Please sign in to comment.