Remove the autoPeek stuff and always either peek or show the join prompt bar
This commit is contained in:
parent
d1dc082489
commit
d132c75263
1 changed files with 7 additions and 34 deletions
|
@ -56,34 +56,11 @@ module.exports = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
joinRoom: function(roomId, shouldPeek) {
|
showRoom: function(roomId) {
|
||||||
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({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
auto_peek: false, // don't peek as we've already peeked here (if it was needed)
|
|
||||||
room_id: roomId
|
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
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getRows: function(filter) {
|
getRows: function(filter) {
|
||||||
|
@ -103,7 +80,6 @@ module.exports = React.createClass({
|
||||||
var name = rooms[i].name || rooms[i].aliases[0];
|
var name = rooms[i].name || rooms[i].aliases[0];
|
||||||
guestRead = null;
|
guestRead = null;
|
||||||
guestJoin = null;
|
guestJoin = null;
|
||||||
var shouldPeek = false;
|
|
||||||
|
|
||||||
if (rooms[i].world_readable) {
|
if (rooms[i].world_readable) {
|
||||||
guestRead = (
|
guestRead = (
|
||||||
|
@ -111,9 +87,6 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
// <img src="img/members.svg"
|
// <img src="img/members.svg"
|
||||||
// alt="World Readable" title="World Readable" width="12" height="12" />
|
// alt="World Readable" title="World Readable" width="12" height="12" />
|
||||||
if (rooms[i].world_readable) {
|
|
||||||
shouldPeek = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (rooms[i].guest_can_join) {
|
if (rooms[i].guest_can_join) {
|
||||||
guestJoin = (
|
guestJoin = (
|
||||||
|
@ -131,12 +104,12 @@ module.exports = React.createClass({
|
||||||
// <img src={ MatrixClientPeg.get().getAvatarUrlForRoom(rooms[i].room_id, 40, 40, "crop") } width="40" height="40" alt=""/>
|
// <img src={ MatrixClientPeg.get().getAvatarUrlForRoom(rooms[i].room_id, 40, 40, "crop") } width="40" height="40" alt=""/>
|
||||||
rows.unshift(
|
rows.unshift(
|
||||||
<tbody key={ rooms[i].room_id }>
|
<tbody key={ rooms[i].room_id }>
|
||||||
<tr onClick={self.joinRoom.bind(null, rooms[i].room_id, shouldPeek)}>
|
<tr onClick={self.showRoom.bind(null, rooms[i].room_id)}>
|
||||||
<td className="mx_RoomDirectory_name">{ name }</td>
|
<td className="mx_RoomDirectory_name">{ name }</td>
|
||||||
<td>{ rooms[i].aliases[0] }</td>
|
<td>{ rooms[i].aliases[0] }</td>
|
||||||
<td>{ rooms[i].num_joined_members }</td>
|
<td>{ rooms[i].num_joined_members }</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr onClick={self.joinRoom.bind(null, rooms[i].room_id, shouldPeek)}>
|
<tr onClick={self.showRoom.bind(null, rooms[i].room_id)}>
|
||||||
<td className="mx_RoomDirectory_topic" colSpan="3">{perms} { rooms[i].topic }</td>
|
<td className="mx_RoomDirectory_topic" colSpan="3">{perms} { rooms[i].topic }</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -149,7 +122,7 @@ module.exports = React.createClass({
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
this.setState({ roomAlias : this.refs.roomAlias.value })
|
this.setState({ roomAlias : this.refs.roomAlias.value })
|
||||||
if (ev.key == "Enter") {
|
if (ev.key == "Enter") {
|
||||||
this.joinRoom(this.refs.roomAlias.value);
|
this.showRoom(this.refs.roomAlias.value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue