mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge pull request #846 from vector-im/dbkr/no_auto_join
Don't trigger room join from room directory: always peek / show join prompt bar
This commit is contained in:
commit
f0a1f6d926
@ -56,34 +56,11 @@ 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() {
|
||||
showRoom: function(roomId) {
|
||||
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
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getRows: function(filter) {
|
||||
@ -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({
|
||||
);
|
||||
// <img src="img/members.svg"
|
||||
// alt="World Readable" title="World Readable" width="12" height="12" />
|
||||
if (rooms[i].world_readable) {
|
||||
shouldPeek = true;
|
||||
}
|
||||
}
|
||||
if (rooms[i].guest_can_join) {
|
||||
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=""/>
|
||||
rows.unshift(
|
||||
<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>{ rooms[i].aliases[0] }</td>
|
||||
<td>{ rooms[i].num_joined_members }</td>
|
||||
</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>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user