From cd6786114b6b1d49d747be3750d7df763a101e04 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 8 Jun 2017 17:40:53 +0100 Subject: [PATCH 1/2] When joining, use a roomAlias if we have it And default to the current roomId otherwise --- src/stores/RoomViewStore.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stores/RoomViewStore.js b/src/stores/RoomViewStore.js index cc8959af7a..2c5dd9e534 100644 --- a/src/stores/RoomViewStore.js +++ b/src/stores/RoomViewStore.js @@ -137,7 +137,9 @@ class RoomViewStore extends Store { this._setState({ joining: true, }); - MatrixClientPeg.get().joinRoom(this._state.roomId, payload.opts).done(() => { + MatrixClientPeg.get().joinRoom( + this._state.roomAlias || this._state.roomId, payload.opts, + ).done(() => { dis.dispatch({ action: 'joined_room', }); From 3218cae6e3bdce6265826df4d02f6f008240e328 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 8 Jun 2017 17:47:48 +0100 Subject: [PATCH 2/2] Expect to join by alias if given to RVS --- test/stores/RoomViewStore-test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/stores/RoomViewStore-test.js b/test/stores/RoomViewStore-test.js index 2f545ffd74..adcae90e9b 100644 --- a/test/stores/RoomViewStore-test.js +++ b/test/stores/RoomViewStore-test.js @@ -28,8 +28,8 @@ describe('RoomViewStore', function() { }); it('can be used to view a room by ID and join', function(done) { - peg.get().joinRoom = (roomId) => { - expect(roomId).toBe("!randomcharacters:aser.ver"); + peg.get().joinRoom = (roomAddress) => { + expect(roomAddress).toBe("!randomcharacters:aser.ver"); done(); }; @@ -40,8 +40,8 @@ describe('RoomViewStore', function() { it('can be used to view a room by alias and join', function(done) { peg.get().getRoomIdForAlias.returns(q({room_id: "!randomcharacters:aser.ver"})); - peg.get().joinRoom = (roomId) => { - expect(roomId).toBe("!randomcharacters:aser.ver"); + peg.get().joinRoom = (roomAddress) => { + expect(roomAddress).toBe("#somealias2:aser.ver"); done(); };