mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
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:
+2
-1
@@ -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
|
||||
|
||||
+16
-1
@@ -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),
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user