-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash: open private room by link #5786
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM. It could be nice to externalize the conversion of a roomAlias to a roomId or to support aliases for the navigation?
Co-authored-by: giomfo <[email protected]>
@@ -296,8 +297,13 @@ class MatrixToBottomSheetViewModel @AssistedInject constructor( | |||
} | |||
viewModelScope.launch { | |||
try { | |||
session.joinRoom(action.roomId, null, action.viaServers?.take(3) ?: emptyList()) | |||
_viewEvents.post(MatrixToViewEvents.NavigateToRoom(action.roomId)) | |||
session.joinRoom(action.roomIdOrAlias, null, action.viaServers?.take(3) ?: emptyList()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to help give extra context it would be handy if the null / true
arguments used named parameters (or we could extract constants)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put the named parameters for all the arguments here :) it's more understandable.
session.joinRoom(action.roomId, null, action.viaServers?.take(3) ?: emptyList()) | ||
_viewEvents.post(MatrixToViewEvents.NavigateToRoom(action.roomId)) | ||
session.joinRoom(action.roomIdOrAlias, null, action.viaServers?.take(3) ?: emptyList()) | ||
val roomId: String = if (MatrixPatterns.isRoomAlias(action.roomIdOrAlias)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think it's worth extracting out a method for converting roomIdOrAlias
to just roomId
?
@@ -24,7 +24,7 @@ sealed class MatrixToAction : VectorViewModelAction { | |||
object FailedToResolveUser : MatrixToAction() | |||
object FailedToStartChatting : MatrixToAction() | |||
data class JoinSpace(val spaceID: String, val viaServers: List<String>?) : MatrixToAction() | |||
data class JoinRoom(val roomId: String, val viaServers: List<String>?) : MatrixToAction() | |||
data class JoinRoom(val roomIdOrAlias: String, val viaServers: List<String>?) : MatrixToAction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking out loud for the future, I could imagine separate types for roomId
, spaceId
and roomAlias
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it could be separate. But i think this will generate a refacto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some very minor comments, LGTM! 💯 will leave up to you to address if wanted
This reverts commit 9a83da4.
@@ -309,6 +314,12 @@ class MatrixToBottomSheetViewModel @AssistedInject constructor( | |||
} | |||
} | |||
|
|||
private suspend fun getRoomIdFromRoomIdOrAlias(roomIdOrAlias: String): String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Type of change
Content
Use roomId instead of alias for NavigateToRoom
In some cases, the alias was used instead of the room id. The alias was blocking the room creation in the DB.
Motivation and context
tchapgouv/tchap-android#554
Screenshots / GIFs
Tests
Tested devices
Checklist