forked from matrix/element-web
Merge pull request #2587 from vector-im/rav/view_clear_source
Add a 'View decrypted source' button
This commit is contained in:
commit
dace762a6c
|
@ -22,7 +22,8 @@ module.exports = React.createClass({
|
||||||
displayName: 'ViewSource',
|
displayName: 'ViewSource',
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
onFinished: React.PropTypes.func.isRequired
|
content: React.PropTypes.object.isRequired,
|
||||||
|
onFinished: React.PropTypes.func.isRequired,
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
@ -45,10 +46,9 @@ module.exports = React.createClass({
|
||||||
return (
|
return (
|
||||||
<div className="mx_ViewSource">
|
<div className="mx_ViewSource">
|
||||||
<pre>
|
<pre>
|
||||||
{JSON.stringify(this.props.mxEvent.event, null, 2)}
|
{JSON.stringify(this.props.content, null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,16 @@ module.exports = React.createClass({
|
||||||
onViewSourceClick: function() {
|
onViewSourceClick: function() {
|
||||||
var ViewSource = sdk.getComponent('structures.ViewSource');
|
var ViewSource = sdk.getComponent('structures.ViewSource');
|
||||||
Modal.createDialog(ViewSource, {
|
Modal.createDialog(ViewSource, {
|
||||||
mxEvent: this.props.mxEvent
|
content: this.props.mxEvent.event,
|
||||||
|
}, 'mx_Dialog_viewsource');
|
||||||
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
|
},
|
||||||
|
|
||||||
|
onViewClearSourceClick: function() {
|
||||||
|
const ViewSource = sdk.getComponent('structures.ViewSource');
|
||||||
|
Modal.createDialog(ViewSource, {
|
||||||
|
// FIXME: _clearEvent is private
|
||||||
|
content: this.props.mxEvent._clearEvent,
|
||||||
}, 'mx_Dialog_viewsource');
|
}, 'mx_Dialog_viewsource');
|
||||||
if (this.props.onFinished) this.props.onFinished();
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
},
|
},
|
||||||
|
@ -97,6 +106,7 @@ module.exports = React.createClass({
|
||||||
var eventStatus = this.props.mxEvent.status;
|
var eventStatus = this.props.mxEvent.status;
|
||||||
var resendButton;
|
var resendButton;
|
||||||
var viewSourceButton;
|
var viewSourceButton;
|
||||||
|
var viewClearSourceButton;
|
||||||
var redactButton;
|
var redactButton;
|
||||||
var cancelButton;
|
var cancelButton;
|
||||||
var permalinkButton;
|
var permalinkButton;
|
||||||
|
@ -133,6 +143,14 @@ module.exports = React.createClass({
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (this.props.mxEvent.getType() !== this.props.mxEvent.getWireType()) {
|
||||||
|
viewClearSourceButton = (
|
||||||
|
<div className="mx_MessageContextMenu_field" onClick={this.onViewClearSourceClick}>
|
||||||
|
View Decrypted Source
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.props.eventTileOps) {
|
if (this.props.eventTileOps) {
|
||||||
if (this.props.eventTileOps.isWidgetHidden()) {
|
if (this.props.eventTileOps.isWidgetHidden()) {
|
||||||
unhidePreviewButton = (
|
unhidePreviewButton = (
|
||||||
|
@ -174,6 +192,7 @@ module.exports = React.createClass({
|
||||||
{redactButton}
|
{redactButton}
|
||||||
{cancelButton}
|
{cancelButton}
|
||||||
{viewSourceButton}
|
{viewSourceButton}
|
||||||
|
{viewClearSourceButton}
|
||||||
{unhidePreviewButton}
|
{unhidePreviewButton}
|
||||||
{permalinkButton}
|
{permalinkButton}
|
||||||
{UserSettingsStore.isFeatureEnabled('rich_text_editor') ? quoteButton : null}
|
{UserSettingsStore.isFeatureEnabled('rich_text_editor') ? quoteButton : null}
|
||||||
|
|
Loading…
Reference in New Issue