Merge pull request #3441 from matrix-org/bwindels/fixroomdir-itemclick-bis

Fix: stop propagation click handler for <TR> doesn't run
pull/21833/head
Bruno Windels 2019-09-13 13:08:42 +00:00 committed by GitHub
commit 40bd1845d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -368,25 +368,27 @@ module.exports = createReactClass({
}
},
onPreviewClick: function(room) {
onPreviewClick: function(ev, room) {
this.props.onFinished();
dis.dispatch({
action: 'view_room',
room_id: room.room_id,
should_peek: true,
});
ev.stopPropagation();
},
onViewClick: function(room) {
onViewClick: function(ev, room) {
this.props.onFinished();
dis.dispatch({
action: 'view_room',
room_id: room.room_id,
should_peek: false,
});
ev.stopPropagation();
},
onJoinClick: function(room) {
onJoinClick: function(ev, room) {
this.props.onFinished();
MatrixClientPeg.get().joinRoom(room.room_id);
dis.dispatch({
@ -394,6 +396,7 @@ module.exports = createReactClass({
room_id: room.room_id,
joining: true,
});
ev.stopPropagation();
},
onCreateRoomClick: function(room) {
@ -457,16 +460,16 @@ module.exports = createReactClass({
if (room.world_readable && !hasJoinedRoom) {
previewButton = (
<AccessibleButton kind="secondary" onClick={() => this.onPreviewClick(room)}>{_t("Preview")}</AccessibleButton>
<AccessibleButton kind="secondary" onClick={(ev) => this.onPreviewClick(ev, room)}>{_t("Preview")}</AccessibleButton>
);
}
if (hasJoinedRoom) {
joinOrViewButton = (
<AccessibleButton kind="secondary" onClick={() => this.onViewClick(room)}>{_t("View")}</AccessibleButton>
<AccessibleButton kind="secondary" onClick={(ev) => this.onViewClick(ev, room)}>{_t("View")}</AccessibleButton>
);
} else if (!isGuest || room.guest_can_join) {
joinOrViewButton = (
<AccessibleButton kind="primary" onClick={() => this.onJoinClick(room)}>{_t("Join")}</AccessibleButton>
<AccessibleButton kind="primary" onClick={(ev) => this.onJoinClick(ev, room)}>{_t("Join")}</AccessibleButton>
);
}