mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Follow permalinks to and from threads (#5414)
* Implement navigation to event inside a thread when a permalink is used * Fix permalink navigation in threads to rooms * Fix navigating to a different thread from a permalink in an existing thread * Fix tests * Add missing tests for thread navigation * Reduce number of diff between ThreadedMessagesNode.kt and MessagesNode.kt * Navigate back to the room when a link to the current room is clicked in a thread. --------- Co-authored-by: Benoit Marty <benoitm@element.io> Co-authored-by: Benoit Marty <benoit@matrix.org>
This commit is contained in:
committed by
GitHub
parent
43ad8743b8
commit
72c766d73a
+3
-1
@@ -244,7 +244,9 @@ interface BaseRoom : Closeable {
|
||||
|
||||
suspend fun subscribeToCallDecline(notificationEventId: EventId): Flow<UserId>
|
||||
|
||||
/**
|
||||
suspend fun threadRootIdForEvent(eventId: EventId): Result<ThreadId?>
|
||||
|
||||
/**
|
||||
* Destroy the room and release all resources associated to it.
|
||||
*/
|
||||
fun destroy()
|
||||
|
||||
+8
@@ -322,4 +322,12 @@ class RustBaseRoom(
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun threadRootIdForEvent(eventId: EventId): Result<ThreadId?> = withContext(roomDispatcher) {
|
||||
runCatchingExceptions {
|
||||
innerRoom.loadOrFetchEvent(eventId.value).use {
|
||||
it.threadRootEventId()?.let(::ThreadId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -71,6 +71,7 @@ class FakeBaseRoom(
|
||||
private val forgetResult: () -> Result<Unit> = { lambdaError() },
|
||||
private val reportRoomResult: (String?) -> Result<Unit> = { lambdaError() },
|
||||
private val predecessorRoomResult: () -> PredecessorRoom? = { null },
|
||||
private val threadRootIdForEventResult: (EventId) -> Result<ThreadId?> = { lambdaError() },
|
||||
) : BaseRoom {
|
||||
private val _roomInfoFlow: MutableStateFlow<RoomInfo> = MutableStateFlow(initialRoomInfo)
|
||||
override val roomInfoFlow: StateFlow<RoomInfo> = _roomInfoFlow
|
||||
@@ -244,6 +245,10 @@ class FakeBaseRoom(
|
||||
fun givenUpdateMembersResult(result: () -> Unit) {
|
||||
updateMembersResult = result
|
||||
}
|
||||
|
||||
override suspend fun threadRootIdForEvent(eventId: EventId): Result<ThreadId?> {
|
||||
return threadRootIdForEventResult(eventId)
|
||||
}
|
||||
}
|
||||
|
||||
fun defaultRoomPowerLevelValues() = RoomPowerLevelsValues(
|
||||
|
||||
Reference in New Issue
Block a user