diff --git a/src/components/structures/ViewSource.js b/src/components/structures/ViewSource.js
index 1dbc5319..a0e198ce 100644
--- a/src/components/structures/ViewSource.js
+++ b/src/components/structures/ViewSource.js
@@ -22,7 +22,8 @@ module.exports = React.createClass({
displayName: 'ViewSource',
propTypes: {
- onFinished: React.PropTypes.func.isRequired
+ content: React.PropTypes.object.isRequired,
+ onFinished: React.PropTypes.func.isRequired,
},
componentDidMount: function() {
@@ -45,10 +46,9 @@ module.exports = React.createClass({
return (
- {JSON.stringify(this.props.mxEvent.event, null, 2)}
+ {JSON.stringify(this.props.content, null, 2)}
);
}
});
-
diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js
index 7786b9bd..e3640f77 100644
--- a/src/components/views/context_menus/MessageContextMenu.js
+++ b/src/components/views/context_menus/MessageContextMenu.js
@@ -47,7 +47,16 @@ module.exports = React.createClass({
onViewSourceClick: function() {
var ViewSource = sdk.getComponent('structures.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');
if (this.props.onFinished) this.props.onFinished();
},
@@ -97,6 +106,7 @@ module.exports = React.createClass({
var eventStatus = this.props.mxEvent.status;
var resendButton;
var viewSourceButton;
+ var viewClearSourceButton;
var redactButton;
var cancelButton;
var permalinkButton;
@@ -133,6 +143,14 @@ module.exports = React.createClass({
);
+ if (this.props.mxEvent.getType() !== this.props.mxEvent.getWireType()) {
+ viewClearSourceButton = (
+
+ View Decrypted Source
+
+ );
+ }
+
if (this.props.eventTileOps) {
if (this.props.eventTileOps.isWidgetHidden()) {
unhidePreviewButton = (
@@ -174,6 +192,7 @@ module.exports = React.createClass({
{redactButton}
{cancelButton}
{viewSourceButton}
+ {viewClearSourceButton}
{unhidePreviewButton}
{permalinkButton}
{UserSettingsStore.isFeatureEnabled('rich_text_editor') ? quoteButton : null}