Fix thread navigation in timeline (#12412)

* Remove thread dispatch action

* Add comment

* Add e2e test
This commit is contained in:
Florian Duros 2024-04-12 11:07:57 +02:00 committed by GitHub
parent 77dfc1abee
commit aadb46358b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 70 additions and 10 deletions

View file

@ -707,6 +707,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
newState.initialEventPixelOffset = undefined;
const thread = initialEvent?.getThread();
// Handle the use case of a link to a thread message
// ie: #/room/roomId/eventId (eventId of a thread message)
if (thread?.rootEvent && !initialEvent?.isThreadRoot) {
dis.dispatch<ShowThreadPayload>({
action: Action.ShowThread,
@ -719,16 +721,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
newState.initialEventId = initialEventId;
newState.isInitialEventHighlighted = this.context.roomViewStore.isInitialEventHighlighted();
newState.initialEventScrollIntoView = this.context.roomViewStore.initialEventScrollIntoView();
if (thread?.rootEvent && initialEvent?.isThreadRoot) {
dis.dispatch<ShowThreadPayload>({
action: Action.ShowThread,
rootEvent: thread.rootEvent,
initialEvent,
highlighted: this.context.roomViewStore.isInitialEventHighlighted(),
scroll_into_view: this.context.roomViewStore.initialEventScrollIntoView(),
});
}
}
}