Merge pull request #5235 from matrix-org/t3chguy/15228

Fix Room Directory View & Preview actions for federated joins
This commit is contained in:
Michael Telatynski 2020-09-18 22:10:23 +01:00 committed by GitHub
commit 1b335da1b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -392,22 +392,12 @@ export default class RoomDirectory extends React.Component {
};
onPreviewClick = (ev, room) => {
this.props.onFinished();
dis.dispatch({
action: 'view_room',
room_id: room.room_id,
should_peek: true,
});
this.showRoom(room, null, false, true);
ev.stopPropagation();
};
onViewClick = (ev, room) => {
this.props.onFinished();
dis.dispatch({
action: 'view_room',
room_id: room.room_id,
should_peek: false,
});
this.showRoom(room);
ev.stopPropagation();
};
@ -428,11 +418,12 @@ export default class RoomDirectory extends React.Component {
this.showRoom(null, alias, autoJoin);
}
showRoom(room, room_alias, autoJoin=false) {
showRoom(room, room_alias, autoJoin = false, shouldPeek = false) {
this.props.onFinished();
const payload = {
action: 'view_room',
auto_join: autoJoin,
should_peek: shouldPeek,
};
if (room) {
// Don't let the user view a room they won't be able to either
@ -457,6 +448,7 @@ export default class RoomDirectory extends React.Component {
};
if (this.state.roomServer) {
payload.via_servers = [this.state.roomServer];
payload.opts = {
viaServers: [this.state.roomServer],
};