Fix joining rooms from directory via federation isn't working. (#808)

This commit is contained in:
Benoit Marty 2020-02-20 18:57:29 +01:00
parent b72698d63c
commit fd05fe36f5
4 changed files with 4 additions and 3 deletions

View File

@ -15,6 +15,7 @@ Bugfix 🐛:
- Account creation: wrongly hints that an email can be used to create an account (#941)
- Fix crash in the room directory, when public room has no name (#1023)
- Fix restoring keys backup with passphrase (#526)
- Fix joining rooms from directory via federation isn't working. (#808)
Translations 🗣:
-

View File

@ -134,7 +134,7 @@ class PublicRoomsFragment @Inject constructor(
override fun onPublicRoomJoin(publicRoom: PublicRoom) {
Timber.v("PublicRoomJoinClicked: $publicRoom")
viewModel.handle(RoomDirectoryAction.JoinRoom(publicRoom.roomId))
viewModel.handle(RoomDirectoryAction.JoinRoom(publicRoom.getPrimaryAlias(), publicRoom.roomId))
}
override fun loadMore() {

View File

@ -23,5 +23,5 @@ sealed class RoomDirectoryAction : VectorViewModelAction {
data class SetRoomDirectoryData(val roomDirectoryData: RoomDirectoryData) : RoomDirectoryAction()
data class FilterWith(val filter: String) : RoomDirectoryAction()
object LoadMore : RoomDirectoryAction()
data class JoinRoom(val roomId: String) : RoomDirectoryAction()
data class JoinRoom(val roomAlias: String?, val roomId: String) : RoomDirectoryAction()
}

View File

@ -216,7 +216,7 @@ class RoomDirectoryViewModel @AssistedInject constructor(@Assisted initialState:
)
}
session.joinRoom(action.roomId, callback = object : MatrixCallback<Unit> {
session.joinRoom(action.roomAlias ?: action.roomId, callback = object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
// We do not update the joiningRoomsIds here, because, the room is not joined yet regarding the sync data.
// Instead, we wait for the room to be joined