diff --git a/res/css/structures/_ViewSource.scss b/res/css/structures/_ViewSource.scss
index 421d1f03cd..0cb5dd8f3a 100644
--- a/res/css/structures/_ViewSource.scss
+++ b/res/css/structures/_ViewSource.scss
@@ -22,9 +22,18 @@ limitations under the License.
float: right;
}
-.mx_ViewSource_label_bottom {
+.mx_ViewSource_separator {
clear: both;
border-bottom: 1px solid #e5e5e5;
+ padding-top: 0.7em;
+ padding-bottom: 0.7em;
+}
+
+.mx_ViewSource_heading {
+ font-size: $font-17px;
+ font-weight: 400;
+ color: $primary-fg-color;
+ margin-top: 0.7em;
}
.mx_ViewSource pre {
diff --git a/src/components/structures/ViewSource.js b/src/components/structures/ViewSource.js
index 0b969784e5..866f2e0a0b 100644
--- a/src/components/structures/ViewSource.js
+++ b/src/components/structures/ViewSource.js
@@ -19,7 +19,7 @@ limitations under the License.
import React from 'react';
import PropTypes from 'prop-types';
import SyntaxHighlight from '../views/elements/SyntaxHighlight';
-import {_t} from "../../languageHandler";
+import {_t, _td} from "../../languageHandler";
import * as sdk from "../../index";
@@ -29,20 +29,36 @@ export default class ViewSource extends React.Component {
onFinished: PropTypes.func.isRequired,
roomId: PropTypes.string.isRequired,
eventId: PropTypes.string.isRequired,
+ isEncrypted: PropTypes.bool.isRequired,
+ decryptedContent: PropTypes.object,
};
render() {
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
+
+ const DecryptedSection = <>
+
+ {_t("Decrypted event source")}
+
+ { JSON.stringify(this.props.decryptedContent, null, 2) }
+
+ >;
+
+ const OriginalSection = <>
+
+ {_t("Original event source")}
+
+ { JSON.stringify(this.props.content, null, 2) }
+
+ >;
+
return (
- Room ID: { this.props.roomId }
- Event ID: { this.props.eventId }
-
-
-
- { JSON.stringify(this.props.content, null, 2) }
-
+
Room ID: { this.props.roomId }
+
Event ID: { this.props.eventId }
+ { this.props.isEncrypted && DecryptedSection }
+ { OriginalSection }
);
diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js
index 6b871e4f24..b002d1ec62 100644
--- a/src/components/views/context_menus/MessageContextMenu.js
+++ b/src/components/views/context_menus/MessageContextMenu.js
@@ -130,6 +130,8 @@ export default class MessageContextMenu extends React.Component {
roomId: ev.getRoomId(),
eventId: ev.getId(),
content: ev.event,
+ isEncrypted: this.props.mxEvent.getType() !== this.props.mxEvent.getWireType(),
+ decryptedContent: ev._clearEvent,
}, 'mx_Dialog_viewsource');
this.closeMenu();
};
@@ -309,7 +311,6 @@ export default class MessageContextMenu extends React.Component {
let cancelButton;
let forwardButton;
let pinButton;
- let viewClearSourceButton;
let unhidePreviewButton;
let externalURLButton;
let quoteButton;
@@ -389,14 +390,6 @@ export default class MessageContextMenu extends React.Component {
);
- if (mxEvent.getType() !== mxEvent.getWireType()) {
- viewClearSourceButton = (
-
- );
- }
-
if (this.props.eventTileOps) {
if (this.props.eventTileOps.isWidgetHidden()) {
unhidePreviewButton = (
@@ -481,7 +474,6 @@ export default class MessageContextMenu extends React.Component {
{ forwardButton }
{ pinButton }
{ viewSourceButton }
- { viewClearSourceButton }
{ unhidePreviewButton }
{ permalinkButton }
{ quoteButton }
diff --git a/src/components/views/dialogs/RoomSettingsDialog.js b/src/components/views/dialogs/RoomSettingsDialog.js
index 9d9313f08f..368f2aeccd 100644
--- a/src/components/views/dialogs/RoomSettingsDialog.js
+++ b/src/components/views/dialogs/RoomSettingsDialog.js
@@ -116,7 +116,7 @@ export default class RoomSettingsDialog extends React.Component {
return (
-
+
diff --git a/src/components/views/dialogs/UserSettingsDialog.js b/src/components/views/dialogs/UserSettingsDialog.js
index 7164540aea..3291fa2387 100644
--- a/src/components/views/dialogs/UserSettingsDialog.js
+++ b/src/components/views/dialogs/UserSettingsDialog.js
@@ -155,7 +155,7 @@ export default class UserSettingsDialog extends React.Component {
return (
-
+
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index fa7f446b7c..b777adcf0c 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -2875,5 +2875,7 @@
"Esc": "Esc",
"Enter": "Enter",
"Space": "Space",
- "End": "End"
+ "End": "End",
+ "Decrypted event source": "Decrypted event source",
+ "Original event source": "Original event source"
}
diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json
index a1275fb089..9dc6d18f8a 100644
--- a/src/i18n/strings/en_US.json
+++ b/src/i18n/strings/en_US.json
@@ -650,5 +650,7 @@
"Error upgrading room": "Error upgrading room",
"Double check that your server supports the room version chosen and try again.": "Double check that your server supports the room version chosen and try again.",
"Changes the avatar of the current room": "Changes the avatar of the current room",
- "Changes your avatar in all rooms": "Changes your avatar in all rooms"
+ "Changes your avatar in all rooms": "Changes your avatar in all rooms",
+ "Decrypted event source": "Decrypted event source",
+ "Original event source": "Original event source"
}