From ed2f88fd79ed9ee683d65362e683ccb8c5929ad6 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 11 Jul 2019 08:39:41 -0600 Subject: [PATCH] Autojoin rooms when clicking the tombstone Fixes https://github.com/vector-im/riot-web/issues/10299 --- src/components/views/rooms/MessageComposer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index f68bff9eca..adfc0a7999 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -321,15 +321,22 @@ export default class MessageComposer extends React.Component { const createEvent = replacementRoom.currentState.getStateEvents('m.room.create', ''); if (createEvent && createEvent.getId()) createEventId = createEvent.getId(); } + + const viaServers = [this.state.tombstone.getSender().split(':').splice(1).join(':')]; dis.dispatch({ action: 'view_room', highlighted: true, event_id: createEventId, room_id: replacementRoomId, + auto_join: true, // Try to join via the server that sent the event. This converts @something:example.org // into a server domain by splitting on colons and ignoring the first entry ("@something"). - via_servers: [this.state.tombstone.getSender().split(':').splice(1).join(':')], + via_servers: viaServers, + opts: { + // These are passed down to the js-sdk's /join call + viaServers: viaServers, + }, }); }