mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Merge pull request #7352 from hayaksi1/fix/6189-no-call-in-empty-dm
Do not offer to start a call in a DM with no other member
This commit is contained in:
+5
-2
@@ -60,13 +60,16 @@ class RoomCallStatePresenter(
|
|||||||
isUserLocallyInTheCall = isUserLocallyInTheCall,
|
isUserLocallyInTheCall = isUserLocallyInTheCall,
|
||||||
isAudioCall = roomInfo.activeCallIntentConsensus.isAudio(),
|
isAudioCall = roomInfo.activeCallIntentConsensus.isAudio(),
|
||||||
)
|
)
|
||||||
else -> RoomCallState.StandBy(
|
else -> {
|
||||||
canStartCall = canJoinCall,
|
val isEmptyDm = roomInfo.isDm && roomInfo.activeMembersCount <= 1
|
||||||
|
RoomCallState.StandBy(
|
||||||
|
canStartCall = canJoinCall && !isEmptyDm,
|
||||||
isDM = roomInfo.isDm
|
isDM = roomInfo.isDm
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return callState
|
return callState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+36
@@ -49,6 +49,42 @@ class RoomCallStatePresenterTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `present - a DM with no other member cannot start a call`() = runTest {
|
||||||
|
val room = FakeJoinedRoom(
|
||||||
|
baseRoom = FakeBaseRoom(
|
||||||
|
initialRoomInfo = aRoomInfo(isDm = true, activeMembersCount = 1, 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 - a DM becomes callable once the other member is active`() = runTest {
|
||||||
|
val baseRoom = FakeBaseRoom(
|
||||||
|
initialRoomInfo = aRoomInfo(isDm = true, activeMembersCount = 1, joinedMembersCount = 1),
|
||||||
|
roomPermissions = roomPermissions(true),
|
||||||
|
)
|
||||||
|
val room = FakeJoinedRoom(baseRoom = baseRoom)
|
||||||
|
val presenter = createRoomCallStatePresenter(joinedRoom = room)
|
||||||
|
presenter.test {
|
||||||
|
skipItems(1)
|
||||||
|
assertThat(awaitItem()).isEqualTo(RoomCallState.StandBy(canStartCall = false, isDM = true))
|
||||||
|
baseRoom.givenRoomInfo(aRoomInfo(isDm = true, activeMembersCount = 2, joinedMembersCount = 2))
|
||||||
|
assertThat(awaitItem()).isEqualTo(RoomCallState.StandBy(canStartCall = true, isDM = true))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `present - element call not available`() = runTest {
|
fun `present - element call not available`() = runTest {
|
||||||
val room = FakeJoinedRoom(
|
val room = FakeJoinedRoom(
|
||||||
|
|||||||
Reference in New Issue
Block a user