mirror of
https://github.com/element-hq/element-web
synced 2024-10-26 12:45:53 +03:00
explicitly rejoin parted rooms
This commit is contained in:
parent
424540e57a
commit
970bc84bb6
1 changed files with 22 additions and 18 deletions
|
@ -99,19 +99,24 @@ var commands = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to find a room with this alias
|
// Try to find a room with this alias
|
||||||
|
// XXX: do we need to do this? Doesn't the JS SDK suppress duplicate attempts to join the same room?
|
||||||
var foundRoom = MatrixTools.getRoomForAlias(
|
var foundRoom = MatrixTools.getRoomForAlias(
|
||||||
MatrixClientPeg.get().getRooms(),
|
MatrixClientPeg.get().getRooms(),
|
||||||
room_alias
|
room_alias
|
||||||
);
|
);
|
||||||
if (foundRoom) { // we've already joined this room, view it.
|
|
||||||
|
if (foundRoom) { // we've already joined this room, view it if it's not archived.
|
||||||
|
var me = foundRoom.getMember(MatrixClientPeg.get().credentials.userId);
|
||||||
|
if (me && me.membership !== "leave") {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: foundRoom.roomId
|
room_id: foundRoom.roomId
|
||||||
});
|
});
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
// attempt to join this alias.
|
|
||||||
|
// otherwise attempt to join this alias.
|
||||||
return success(
|
return success(
|
||||||
MatrixClientPeg.get().joinRoom(room_alias).then(
|
MatrixClientPeg.get().joinRoom(room_alias).then(
|
||||||
function(room) {
|
function(room) {
|
||||||
|
@ -123,7 +128,6 @@ var commands = {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return reject("Usage: /join <room_alias>");
|
return reject("Usage: /join <room_alias>");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue