Fix Room Directory View & Preview actions for federated joins

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-09-18 15:43:08 +01:00
parent 5a6ab95f84
commit 004c68b394
1 changed files with 5 additions and 13 deletions

View File

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