From 7dc92fe91729dea9782533747df4532cf79948f2 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 13 Aug 2018 17:24:27 +0200 Subject: [PATCH] Avoid clearing e2e encryption keys, also avoid warning --- src/components/structures/UserSettings.js | 25 ++----------------- src/i18n/strings/en_EN.json | 3 --- .../controllers/LazyLoadingController.js | 11 +++++--- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 157540f183..f4dc92aca4 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -887,12 +887,12 @@ module.exports = React.createClass({ }, _onLazyLoadChanging: async function(enabling) { - const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); // don't prevent turning LL off when not supported if (enabling) { const supported = await MatrixClientPeg.get().doesServerSupportLazyLoading(); if (!supported) { await new Promise((resolve) => { + const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); Modal.createDialog(QuestionDialog, { title: _t("Lazy loading members not supported"), description: @@ -907,28 +907,7 @@ module.exports = React.createClass({ return false; } } - const confirmed = await new Promise((resolve) => { - Modal.createDialog(QuestionDialog, { - title: _t("Turn on/off lazy load members"), - description: -
- { _t("To enable or disable the lazy loading of members, " + - "the current synced state needs to be cleared out. " + - "This also includes your end-to-end encryption keys, " + - "so to keep being able to decrypt all your existing encrypted messages, " + - "you'll need to export your E2E room keys and import them again afterwards.") } -
, - button: _t("Clear sync state and reload"), - extraButtons: [ - , - ], - onFinished: resolve, - }); - }); - return confirmed; + return true; }, _renderDeactivateAccount: function() { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index eb05ff36e7..2926f4c87c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1218,9 +1218,6 @@ "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", "Increase performance by only loading room members on first view": "Increase performance by only loading room members on first view", - "Turn on/off lazy load members": "Turn on/off lazy load members", - "To enable or disable the lazy loading of members, the current synced state needs to be cleared out. This also includes your end-to-end encryption keys, so to keep being able to decrypt all your existing encrypted messages, you'll need to export your E2E room keys and import them again afterwards.": "To enable or disable the lazy loading of members, the current synced state needs to be cleared out. This also includes your end-to-end encryption keys, so to keep being able to decrypt all your existing encrypted messages, you'll need to export your E2E room keys and import them again afterwards.", - "Clear sync state and reload": "Clear sync state and reload", "Lazy loading members not supported": "Lazy load members not supported", "Lazy loading is not supported by your current homeserver.": "Lazy loading is not supported by your current homeserver." } diff --git a/src/settings/controllers/LazyLoadingController.js b/src/settings/controllers/LazyLoadingController.js index 334111ef7c..90f095c9ca 100644 --- a/src/settings/controllers/LazyLoadingController.js +++ b/src/settings/controllers/LazyLoadingController.js @@ -15,10 +15,15 @@ limitations under the License. */ import SettingController from "./SettingController"; -import dis from "../../dispatcher"; +import MatrixClientPeg from "../../MatrixClientPeg"; +import PlatformPeg from "../../PlatformPeg"; export default class LazyLoadingController extends SettingController { - onChange(level, roomId, newValue) { - dis.dispatch({action: 'flush_storage_reload'}); + async onChange(level, roomId, newValue) { + if (!PlatformPeg.get()) return; + + MatrixClientPeg.get().stopClient(); + await MatrixClientPeg.get().store.deleteAllData(); + PlatformPeg.get().reload(); } }