From d42fa9d17a3db14bcc78291a216c20c95fe696e5 Mon Sep 17 00:00:00 2001 From: Eric Newport Date: Sun, 22 Apr 2018 22:30:37 -0400 Subject: [PATCH 1/3] Hide inline encryption icons except when hovering over a message Closes https://github.com/vector-im/riot-web/issues/2882 This is a redo of https://github.com/matrix-org/matrix-react-sdk/pull/1707 (see associated discussion there and here: https://github.com/vector-im/riot-web/pull/5988) I tried several times to resolve the conflicts correctly, but could not. Thus, fresh PR. --- res/css/views/rooms/_EventTile.scss | 10 ++++++++++ src/components/structures/UserSettings.js | 1 + src/components/views/rooms/EventTile.js | 6 +++++- src/i18n/strings/en_EN.json | 1 + src/settings/Settings.js | 5 +++++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/res/css/views/rooms/_EventTile.scss b/res/css/views/rooms/_EventTile.scss index 4bb81a2e53..3aa1622e05 100644 --- a/res/css/views/rooms/_EventTile.scss +++ b/res/css/views/rooms/_EventTile.scss @@ -298,6 +298,16 @@ limitations under the License. cursor: pointer; } +.mx_EventTile_e2eIcon[hidden] { + display: none; +} + +/* always override hidden attribute for blocked and warning */ +.mx_EventTile_e2eIcon[hidden][src="img/e2e-blocked.svg"], +.mx_EventTile_e2eIcon[hidden][src="img/e2e-warning.svg"] { + display: block; +} + .mx_EventTile_keyRequestInfo { font-size: 12px; } diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 85223c4eef..d0a7275da2 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -63,6 +63,7 @@ const gHVersionLabel = function(repo, token='') { const SIMPLE_SETTINGS = [ { id: "urlPreviewsEnabled" }, { id: "autoplayGifsAndVideos" }, + { id: "alwaysShowEncryptionIcons" }, { id: "hideReadReceipts" }, { id: "dontSendTypingNotifications" }, { id: "alwaysShowTimestamps" }, diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index ed7851bf2d..565c8b5977 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -742,7 +742,11 @@ function E2ePadlockUnencrypted(props) { } function E2ePadlock(props) { - return ; + if (SettingsStore.getValue("alwaysShowEncryptionIcons")) { + return ; + } else { + return ; + } } module.exports.getHandlerTile = getHandlerTile; diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index d90b120bad..33acb04f31 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -198,6 +198,7 @@ "Show timestamps in 12 hour format (e.g. 2:30pm)": "Show timestamps in 12 hour format (e.g. 2:30pm)", "Always show message timestamps": "Always show message timestamps", "Autoplay GIFs and videos": "Autoplay GIFs and videos", + "Always show encryption icons": "Always show encryption icons", "Enable automatic language detection for syntax highlighting": "Enable automatic language detection for syntax highlighting", "Hide avatars in user and room mentions": "Hide avatars in user and room mentions", "Disable big emoji in chat": "Disable big emoji in chat", diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 8e94be3be1..d214d5417f 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -150,6 +150,11 @@ export const SETTINGS = { displayName: _td('Autoplay GIFs and videos'), default: false, }, + "alwaysShowEncryptionIcons": { + supportedLevels: LEVELS_ACCOUNT_SETTINGS, + displayName: _td('Always show encryption icons'), + default: true, + }, "enableSyntaxHighlightLanguageDetection": { supportedLevels: LEVELS_ACCOUNT_SETTINGS, displayName: _td('Enable automatic language detection for syntax highlighting'), From 55566b35a25ffa001369a7759e55ed0bbc5532e0 Mon Sep 17 00:00:00 2001 From: Eric Newport Date: Sat, 28 Apr 2018 12:39:25 -0400 Subject: [PATCH 2/3] convert attribute to class --- res/css/views/rooms/_EventTile.scss | 6 +++--- src/components/views/rooms/EventTile.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/res/css/views/rooms/_EventTile.scss b/res/css/views/rooms/_EventTile.scss index 3aa1622e05..db62930be2 100644 --- a/res/css/views/rooms/_EventTile.scss +++ b/res/css/views/rooms/_EventTile.scss @@ -298,13 +298,13 @@ limitations under the License. cursor: pointer; } -.mx_EventTile_e2eIcon[hidden] { +.mx_EventTile_e2eIcon.hidden { display: none; } /* always override hidden attribute for blocked and warning */ -.mx_EventTile_e2eIcon[hidden][src="img/e2e-blocked.svg"], -.mx_EventTile_e2eIcon[hidden][src="img/e2e-warning.svg"] { +.mx_EventTile_e2eIcon.hidden[src="img/e2e-blocked.svg"], +.mx_EventTile_e2eIcon.hidden[src="img/e2e-warning.svg"] { display: block; } diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 565c8b5977..0c85b27162 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -745,7 +745,7 @@ function E2ePadlock(props) { if (SettingsStore.getValue("alwaysShowEncryptionIcons")) { return ; } else { - return ; + return ; } } From e037cf006310609d441d808d8a07be0b3e53a82e Mon Sep 17 00:00:00 2001 From: Eric Newport Date: Mon, 30 Apr 2018 12:22:16 -0400 Subject: [PATCH 3/3] namespace CSS better and fix bug --- res/css/views/rooms/_EventTile.scss | 6 +++--- src/components/views/rooms/EventTile.js | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/res/css/views/rooms/_EventTile.scss b/res/css/views/rooms/_EventTile.scss index db62930be2..788940fe0e 100644 --- a/res/css/views/rooms/_EventTile.scss +++ b/res/css/views/rooms/_EventTile.scss @@ -298,13 +298,13 @@ limitations under the License. cursor: pointer; } -.mx_EventTile_e2eIcon.hidden { +.mx_EventTile_e2eIcon_hidden { display: none; } /* always override hidden attribute for blocked and warning */ -.mx_EventTile_e2eIcon.hidden[src="img/e2e-blocked.svg"], -.mx_EventTile_e2eIcon.hidden[src="img/e2e-warning.svg"] { +.mx_EventTile_e2eIcon_hidden[src="img/e2e-blocked.svg"], +.mx_EventTile_e2eIcon_hidden[src="img/e2e-warning.svg"] { display: block; } diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 0c85b27162..84acfb160e 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -31,6 +31,7 @@ import withMatrixClient from '../../../wrappers/withMatrixClient'; const ContextualMenu = require('../../structures/ContextualMenu'); import dis from '../../../dispatcher'; import {makeEventPermalink} from "../../../matrix-to"; +import SettingsStore from "../../../settings/SettingsStore"; const ObjectUtils = require('../../../ObjectUtils'); @@ -745,7 +746,7 @@ function E2ePadlock(props) { if (SettingsStore.getValue("alwaysShowEncryptionIcons")) { return ; } else { - return ; + return ; } }