Native call: always ask the core to ring, and ring a DM only once its member has joined

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valere
2026-10-15 14:19:29 +02:00
parent 4ebcf960ce
commit 555dca38f5
5 changed files with 28 additions and 6 deletions
@@ -61,7 +61,8 @@ class RoomCallStatePresenter(
isAudioCall = roomInfo.activeCallIntentConsensus.isAudio(),
)
else -> {
val isEmptyDm = roomInfo.isDm && roomInfo.activeMembersCount <= 1
// Joined, not active: an invited member cannot be rung (feature-hq 030 R36).
val isEmptyDm = roomInfo.isDm && roomInfo.joinedMembersCount <= 1
RoomCallState.StandBy(
canStartCall = canJoinCall && !isEmptyDm,
isDM = roomInfo.isDm
@@ -85,6 +85,21 @@ class RoomCallStatePresenterTest {
}
}
@Test
fun `present - a DM whose other member is only invited cannot be called`() = runTest {
val room = FakeJoinedRoom(
baseRoom = FakeBaseRoom(
initialRoomInfo = aRoomInfo(isDm = true, activeMembersCount = 2, joinedMembersCount = 1),
roomPermissions = roomPermissions(true),
)
)
val presenter = createRoomCallStatePresenter(joinedRoom = room)
presenter.test {
skipItems(1)
assertThat(awaitItem()).isEqualTo(RoomCallState.StandBy(canStartCall = false, isDM = true))
}
}
@Test
fun `present - element call not available`() = runTest {
val room = FakeJoinedRoom(
@@ -128,7 +143,7 @@ class RoomCallStatePresenterTest {
fun `present - initial state - when is DM room`() = runTest {
val room = FakeJoinedRoom(
baseRoom = FakeBaseRoom(
initialRoomInfo = aRoomInfo(isDm = true),
initialRoomInfo = aRoomInfo(isDm = true, joinedMembersCount = 2),
roomPermissions = roomPermissions(true),
)
)