From 327b3c860b4f0c622654f83e08454a75a4d5e195 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 25 Mar 2020 18:47:57 +0000 Subject: [PATCH] Adding the files would help --- res/css/views/settings/_E2eAdvancedPanel.scss | 20 ++++++++++ .../views/settings/E2eAdvancedPanel.js | 39 +++++++++++++++++++ .../PushToMatrixClientController.js | 37 ++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 res/css/views/settings/_E2eAdvancedPanel.scss create mode 100644 src/components/views/settings/E2eAdvancedPanel.js create mode 100644 src/settings/controllers/PushToMatrixClientController.js diff --git a/res/css/views/settings/_E2eAdvancedPanel.scss b/res/css/views/settings/_E2eAdvancedPanel.scss new file mode 100644 index 0000000000..9e32685d12 --- /dev/null +++ b/res/css/views/settings/_E2eAdvancedPanel.scss @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +.mx_E2eAdvancedPanel_settingLongDescription { + margin-right: 150px; +} + diff --git a/src/components/views/settings/E2eAdvancedPanel.js b/src/components/views/settings/E2eAdvancedPanel.js new file mode 100644 index 0000000000..709465bcb0 --- /dev/null +++ b/src/components/views/settings/E2eAdvancedPanel.js @@ -0,0 +1,39 @@ +/* +Copyright 2020 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from 'react'; + +import * as sdk from '../../../index'; +import {_t} from "../../../languageHandler"; +import {SettingLevel} from "../../../settings/SettingsStore"; + +const SETTING_MANUALLY_VERIFY_ALL_SESSIONS = "e2ee.manuallyVerifyAllSessions"; + +const E2eAdvancedPanel = props => { + const SettingsFlag = sdk.getComponent('views.elements.SettingsFlag'); + return
+ {_t("Advanced")} + + +
{_t( + "Individually verify each session used by a user to mark it as trusted, not trusting cross-signed devices.", + )}
+
; +}; + +export default E2eAdvancedPanel; diff --git a/src/settings/controllers/PushToMatrixClientController.js b/src/settings/controllers/PushToMatrixClientController.js new file mode 100644 index 0000000000..b7c285227f --- /dev/null +++ b/src/settings/controllers/PushToMatrixClientController.js @@ -0,0 +1,37 @@ +/* +Copyright 2020 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import { MatrixClientPeg } from '../../MatrixClientPeg'; + +/** + * When the value changes, call a setter function on the matrix client with the new value + */ +export default class PushToMatrixClientController { + constructor(setter, inverse) { + this._setter = setter; + this._inverse = inverse; + } + + getValueOverride(level, roomId, calculatedValue, calculatedAtLevel) { + return null; // no override + } + + onChange(level, roomId, newValue) { + // XXX does this work? This surely isn't necessarily the effective value, + // but it's what NotificationsEnabledController does... + this._setter.call(MatrixClientPeg.get(), this._inverse ? !newValue : newValue); + } +}