From b09219fe33ba6af94b6df4b5ed0b441cefa2c852 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 10 Jan 2019 15:29:12 -0700 Subject: [PATCH] Navigate to the upgraded room's create event where possible Fixes https://github.com/vector-im/riot-web/issues/7998 --- src/components/views/rooms/MessageComposer.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index e15ca047ac..ddd3058a5b 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -281,9 +281,17 @@ export default class MessageComposer extends React.Component { ev.preventDefault(); const replacementRoomId = this.state.tombstone.getContent()['replacement_room']; + const replacementRoom = MatrixClientPeg.get().getRoom(replacementRoomId); + let createEventId = null; + if (replacementRoom) { + const createEvent = replacementRoom.currentState.getStateEvents('m.room.create', ''); + if (createEvent && createEvent.getId()) createEventId = createEvent.getId(); + } + this.props.roomViewStore.getDispatcher().dispatch({ action: 'view_room', highlighted: true, + event_id: createEventId, room_id: replacementRoomId, }); }