Merge pull request #6549 from vector-im/feature/bma/fix_6514

Just go back to the timeline if the user is already viewing the DM with the other user.
This commit is contained in:
Benoit Marty 2022-07-18 09:48:44 +02:00 committed by GitHub
commit cdbc197426
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 0 deletions

1
changelog.d/6549.bugfix Normal file
View file

@ -0,0 +1 @@
Fix infinite loading when opening a DM when the current room is the same DM.

View file

@ -17,6 +17,7 @@
package im.vector.app.features.home.room.detail
sealed class RoomDetailPendingAction {
object DoNothing : RoomDetailPendingAction()
data class JumpToReadReceipt(val userId: String) : RoomDetailPendingAction()
data class MentionUser(val userId: String) : RoomDetailPendingAction()
data class OpenRoom(val roomId: String, val closeCurrentRoom: Boolean = false) : RoomDetailPendingAction()

View file

@ -1323,6 +1323,7 @@ class TimelineFragment @Inject constructor(
private fun handlePendingAction(roomDetailPendingAction: RoomDetailPendingAction) {
when (roomDetailPendingAction) {
RoomDetailPendingAction.DoNothing -> Unit
is RoomDetailPendingAction.JumpToReadReceipt ->
timelineViewModel.handle(RoomDetailAction.JumpToReadReceipt(roomDetailPendingAction.userId))
is RoomDetailPendingAction.MentionUser ->

View file

@ -136,6 +136,7 @@ class RoomMemberProfileFragment @Inject constructor(
is RoomMemberProfileViewEvents.OnBanActionSuccess -> Unit
is RoomMemberProfileViewEvents.OnIgnoreActionSuccess -> Unit
is RoomMemberProfileViewEvents.OnInviteActionSuccess -> Unit
RoomMemberProfileViewEvents.GoBack -> handleGoBack()
}
}
setupLongClicks()
@ -309,6 +310,11 @@ class RoomMemberProfileFragment @Inject constructor(
viewModel.handle(RoomMemberProfileAction.OpenOrCreateDm(fragmentArgs.userId))
}
private fun handleGoBack() {
roomDetailPendingActionStore.data = RoomDetailPendingAction.DoNothing
vectorBaseActivity.finish()
}
override fun onJumpToReadReceiptClicked() {
roomDetailPendingActionStore.data = RoomDetailPendingAction.JumpToReadReceipt(fragmentArgs.userId)
vectorBaseActivity.finish()

View file

@ -40,4 +40,5 @@ sealed class RoomMemberProfileViewEvents : VectorViewEvents {
data class ShareRoomMemberProfile(val permalink: String) : RoomMemberProfileViewEvents()
data class OpenRoom(val roomId: String) : RoomMemberProfileViewEvents()
object GoBack : RoomMemberProfileViewEvents()
}

View file

@ -183,6 +183,9 @@ class RoomMemberProfileViewModel @AssistedInject constructor(
}
if (roomId != initialState.roomId) {
_viewEvents.post(RoomMemberProfileViewEvents.OpenRoom(roomId = roomId))
} else {
// Just go back to the previous screen (timeline)
_viewEvents.post(RoomMemberProfileViewEvents.GoBack)
}
}
}