From f8298b2482503d2bb522648d9b08d79ef23c1b16 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 16 Mar 2017 11:36:57 +0000 Subject: [PATCH 1/3] Fix the people section This does two things: - Fixes an incorrect import that was causing Direct Chat toggle to not be editable https://github.com/vector-im/riot-web/issues/3355 - Use props.list in RoomSubList when calculating whether to show IncomingCallDialog. Fixes https://github.com/vector-im/riot-web/issues/2956 --- src/components/structures/RoomSubList.js | 4 ++-- src/components/views/context_menus/RoomTileContextMenu.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index 67c47263a4..3aae164a19 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -417,7 +417,7 @@ var RoomSubList = React.createClass({ if (this.props.incomingCall) { var self = this; // Check if the incoming call is for this section - var incomingCallRoom = this.state.sortedList.filter(function(room) { + var incomingCallRoom = this.props.list.filter(function(room) { return self.props.incomingCall.roomId === room.roomId; }); @@ -507,7 +507,7 @@ var RoomSubList = React.createClass({ var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); console.error("Failed to add tag " + self.props.tagName + " to room" + err); Modal.createDialog(ErrorDialog, { - title: "Error", + title: "Error", description: "Failed to add tag " + self.props.tagName + " to room", }); }); diff --git a/src/components/views/context_menus/RoomTileContextMenu.js b/src/components/views/context_menus/RoomTileContextMenu.js index 0998194edc..289121f1d3 100644 --- a/src/components/views/context_menus/RoomTileContextMenu.js +++ b/src/components/views/context_menus/RoomTileContextMenu.js @@ -24,7 +24,7 @@ import sdk from 'matrix-react-sdk'; import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; import dis from 'matrix-react-sdk/lib/dispatcher'; import DMRoomMap from 'matrix-react-sdk/lib/utils/DMRoomMap'; -import Rooms from 'matrix-react-sdk/lib/Rooms'; +import * as Rooms from 'matrix-react-sdk/lib/Rooms'; import * as RoomNotifs from 'matrix-react-sdk/lib/RoomNotifs'; import Modal from 'matrix-react-sdk/lib/Modal'; From 49be954d315ea81b51f842dc12f87305cddfc42c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 16 Mar 2017 17:03:16 +0000 Subject: [PATCH 2/3] Better CSS for redactions See https://github.com/vector-im/riot-web/issues/3390 Also: The "Redact" option in the MessageContextMenu no longer appears for redacted events. --- .../views/context_menus/MessageContextMenu.js | 2 +- .../matrix-react-sdk/views/rooms/_EventTile.scss | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index e3640f775c..e56a3e2f6f 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -121,7 +121,7 @@ module.exports = React.createClass({ ); } - if (!eventStatus) { // sent + if (!eventStatus && !this.props.mxEvent.isRedacted()) { // sent and not redacted redactButton = (
Redact diff --git a/src/skins/vector/css/matrix-react-sdk/views/rooms/_EventTile.scss b/src/skins/vector/css/matrix-react-sdk/views/rooms/_EventTile.scss index f241d2c5cc..0926a11a74 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/rooms/_EventTile.scss +++ b/src/skins/vector/css/matrix-react-sdk/views/rooms/_EventTile.scss @@ -130,14 +130,13 @@ limitations under the License. color: $event-notsent-color; } -.mx_EventTile_redacted { - padding-top: 0px; -} - -.mx_EventTile_redacted .mx_EventTile_line, -.mx_EventTile_redacted:hover .mx_EventTile_line, -.mx_EventTile_redacted.menu .mx_EventTile_line { - background-color: $primary-fg-color; +.mx_EventTile_redacted .mx_EventTile_line .mx_UnknownBody { + display: block; + width: 100%; + max-width: 300px; + height: 24px; + border-radius: 4px; + background-color: black; } .mx_EventTile_highlight, From a9ed2e20cbfb6cd33a95c9bf5715fc903a93f6d5 Mon Sep 17 00:00:00 2001 From: Keyvan Fatehi Date: Sat, 18 Mar 2017 17:45:13 -0700 Subject: [PATCH 3/3] Confirm redactions with a dialog Closes #277 Closes #1805 Signed-off-by: Keyvan Fatehi --- .../views/context_menus/MessageContextMenu.js | 31 ++++++++++-------- src/components/views/elements/ImageView.js | 32 +++++++++++-------- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index e56a3e2f6f..db416b8a06 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -62,19 +62,24 @@ module.exports = React.createClass({ }, onRedactClick: function() { - MatrixClientPeg.get().redactEvent( - this.props.mxEvent.getRoomId(), this.props.mxEvent.getId() - ).done(function() { - // message should disappear by itself - }, function(e) { - var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); - // display error message stating you couldn't delete this. - var code = e.errcode || e.statusCode; - Modal.createDialog(ErrorDialog, { - title: "Error", - description: "You cannot delete this message. (" + code + ")" - }); - }); + const ConfirmRedactDialog = sdk.getComponent("dialogs.ConfirmRedactDialog"); + Modal.createDialog(ConfirmRedactDialog, { + onFinished: (proceed) => { + if (!proceed) return; + + MatrixClientPeg.get().redactEvent( + this.props.mxEvent.getRoomId(), this.props.mxEvent.getId() + ).catch(function(e) { + var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + // display error message stating you couldn't delete this. + var code = e.errcode || e.statusCode; + Modal.createDialog(ErrorDialog, { + title: "Error", + description: "You cannot delete this message. (" + code + ")" + }); + }).done(); + }, + }, 'mx_Dialog_confirmredact'); if (this.props.onFinished) this.props.onFinished(); }, diff --git a/src/components/views/elements/ImageView.js b/src/components/views/elements/ImageView.js index 4a0c1663be..42730aca79 100644 --- a/src/components/views/elements/ImageView.js +++ b/src/components/views/elements/ImageView.js @@ -23,6 +23,8 @@ var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); var DateUtils = require('matrix-react-sdk/lib/DateUtils'); var filesize = require('filesize'); var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton'); +const Modal = require('matrix-react-sdk/lib/Modal'); +const sdk = require('matrix-react-sdk'); module.exports = React.createClass({ displayName: 'ImageView', @@ -62,19 +64,23 @@ module.exports = React.createClass({ }, onRedactClick: function() { - var self = this; - MatrixClientPeg.get().redactEvent( - this.props.mxEvent.getRoomId(), this.props.mxEvent.getId() - ).done(function() { - if (self.props.onFinished) self.props.onFinished(); - }, function(e) { - var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); - // display error message stating you couldn't delete this. - var code = e.errcode || e.statusCode; - Modal.createDialog(ErrorDialog, { - title: "Error", - description: "You cannot delete this image. (" + code + ")" - }); + const ConfirmRedactDialog = sdk.getComponent("dialogs.ConfirmRedactDialog"); + Modal.createDialog(ConfirmRedactDialog, { + onFinished: (proceed) => { + if (!proceed) return; + var self = this; + MatrixClientPeg.get().redactEvent( + this.props.mxEvent.getRoomId(), this.props.mxEvent.getId() + ).catch(function(e) { + var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + // display error message stating you couldn't delete this. + var code = e.errcode || e.statusCode; + Modal.createDialog(ErrorDialog, { + title: "Error", + description: "You cannot delete this image. (" + code + ")" + }); + }).done(); + } }); },