Skip to content

Commit

Permalink
Merge pull request #5594 from vector-im/feature/aris/thread_root_perm…
Browse files Browse the repository at this point in the history
…alink_navigation

Improve permalink on thread root message
  • Loading branch information
ariskotsomitopoulos authored Apr 5, 2022
2 parents 4ce4ef4 + 0479049 commit d484ba0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/5567.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Permalinks to root thread messages will now navigate you within the thread timeline
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import org.matrix.android.sdk.api.session.permalinks.PermalinkService
import org.matrix.android.sdk.api.session.room.model.Membership
import org.matrix.android.sdk.api.session.room.model.RoomSummary
import org.matrix.android.sdk.api.session.room.model.RoomType
import org.matrix.android.sdk.api.session.room.timeline.isRootThread
import javax.inject.Inject

class PermalinkHandler @Inject constructor(private val activeSessionHolder: ActiveSessionHolder,
Expand Down Expand Up @@ -89,7 +90,13 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti

val rootThreadEventId = permalinkData.eventId?.let { eventId ->
val room = roomId?.let { session?.getRoom(it) }
room?.getTimelineEvent(eventId)?.root?.getRootThreadEventId()

val rootThreadEventId = room?.getTimelineEvent(eventId)?.root?.getRootThreadEventId()
rootThreadEventId ?: if (room?.getTimelineEvent(eventId)?.isRootThread() == true) {
eventId
} else {
null
}
}
openRoom(
navigationInterceptor,
Expand Down

0 comments on commit d484ba0

Please sign in to comment.