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

When joining, use a roomAlias if we have it
This commit is contained in:
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({
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',
});

View file

@ -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();
};