From d132c75263edd24c7b836b284e58f07f52f4697d Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 2 Feb 2016 15:51:23 +0000 Subject: [PATCH] Remove the autoPeek stuff and always either peek or show the join prompt bar --- src/components/structures/RoomDirectory.js | 41 ++++------------------ 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 4ca18f23..0c65e107 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -56,33 +56,10 @@ module.exports = React.createClass({ }); }, - joinRoom: function(roomId, shouldPeek) { - var self = this; - self.setState({ loading: true }); - - var joinOrPeekPromise; - - if (shouldPeek) { - joinOrPeekPromise = MatrixClientPeg.get().peekInRoom(roomId); - } - else { - joinOrPeekPromise = MatrixClientPeg.get().joinRoom(roomId); - } - - joinOrPeekPromise.done(function() { - dis.dispatch({ - action: 'view_room', - auto_peek: false, // don't peek as we've already peeked here (if it was needed) - room_id: roomId - }); - }, function(err) { - console.error("Failed to join room: %s", JSON.stringify(err)); - console.error(err); - var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); - Modal.createDialog(ErrorDialog, { - title: "Failed to join room", - description: err.message - }); + showRoom: function(roomId) { + dis.dispatch({ + action: 'view_room', + room_id: roomId }); }, @@ -103,7 +80,6 @@ module.exports = React.createClass({ var name = rooms[i].name || rooms[i].aliases[0]; guestRead = null; guestJoin = null; - var shouldPeek = false; if (rooms[i].world_readable) { guestRead = ( @@ -111,9 +87,6 @@ module.exports = React.createClass({ ); // World Readable - if (rooms[i].world_readable) { - shouldPeek = true; - } } if (rooms[i].guest_can_join) { guestJoin = ( @@ -131,12 +104,12 @@ module.exports = React.createClass({ // rows.unshift( - + { name } { rooms[i].aliases[0] } { rooms[i].num_joined_members } - + {perms} { rooms[i].topic } @@ -149,7 +122,7 @@ module.exports = React.createClass({ this.forceUpdate(); this.setState({ roomAlias : this.refs.roomAlias.value }) if (ev.key == "Enter") { - this.joinRoom(this.refs.roomAlias.value); + this.showRoom(this.refs.roomAlias.value); } },