From 70334b69ec2cb7510d3a6433142578c0c9c5b688 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 5 Jul 2019 16:11:15 +0200 Subject: [PATCH] implement view source for edits --- .../views/messages/EditHistoryMessage.js | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/views/messages/EditHistoryMessage.js b/src/components/views/messages/EditHistoryMessage.js index 8069a8e290..9d1c4bd784 100644 --- a/src/components/views/messages/EditHistoryMessage.js +++ b/src/components/views/messages/EditHistoryMessage.js @@ -59,6 +59,15 @@ export default class EditHistoryMessage extends React.PureComponent { }, 'mx_Dialog_confirmredact'); }; + _onViewSourceClick = () => { + const ViewSource = sdk.getComponent('structures.ViewSource'); + Modal.createTrackedDialog('View Event Source', '', ViewSource, { + roomId: this.props.mxEvent.getRoomId(), + eventId: this.props.mxEvent.getId(), + content: this.props.mxEvent.event, + }, 'mx_Dialog_viewsource'); + }; + pillifyLinks() { // not present for redacted events if (this.refs.content) { @@ -84,12 +93,19 @@ export default class EditHistoryMessage extends React.PureComponent { _renderActionBar() { const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); // hide the button when already redacted - if (this.props.mxEvent.isRedacted()) { - return null; + let redactButton; + if (!this.props.mxEvent.isRedacted()) { + redactButton = ( + {_t("Remove")} + ); } + const viewSourceButton = ( + {_t("View Source")} + ); // disabled remove button when not allowed return (
- {_t("Remove")} + {redactButton} + {viewSourceButton}
); }