Merge pull request #1062 from matrix-org/luke/fix-rvs-join-by-alias

When joining, use a roomAlias if we have it
pull/21833/head
Richard van der Hoff 2017-06-08 18:41:59 +01:00 committed by GitHub
commit 091d8d3d36
2 changed files with 7 additions and 5 deletions

View File

@ -185,7 +185,9 @@ class RoomViewStore extends Store {
this._setState({ this._setState({
joining: true, 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({ dis.dispatch({
action: 'joined_room', action: 'joined_room',
}); });

View File

@ -28,8 +28,8 @@ describe('RoomViewStore', function() {
}); });
it('can be used to view a room by ID and join', function(done) { it('can be used to view a room by ID and join', function(done) {
peg.get().joinRoom = (roomId) => { peg.get().joinRoom = (roomAddress) => {
expect(roomId).toBe("!randomcharacters:aser.ver"); expect(roomAddress).toBe("!randomcharacters:aser.ver");
done(); done();
}; };
@ -40,8 +40,8 @@ describe('RoomViewStore', function() {
it('can be used to view a room by alias and join', function(done) { 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().getRoomIdForAlias.returns(q({room_id: "!randomcharacters:aser.ver"}));
peg.get().joinRoom = (roomId) => { peg.get().joinRoom = (roomAddress) => {
expect(roomId).toBe("!randomcharacters:aser.ver"); expect(roomAddress).toBe("#somealias2:aser.ver");
done(); done();
}; };