Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Lazy loading: feature toggle #2115

Merged
merged 13 commits into from
Aug 15, 2018
25 changes: 2 additions & 23 deletions src/components/structures/UserSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
<div>
{ _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.") }
</div>,
button: _t("Clear sync state and reload"),
extraButtons: [
<button key="export" className="mx_Dialog_primary"
onClick={this._onExportE2eKeysClicked}>
{ _t("Export E2E room keys") }
</button>,
],
onFinished: resolve,
});
});
return confirmed;
return true;
},

_renderDeactivateAccount: function() {
Expand Down
3 changes: 0 additions & 3 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
11 changes: 8 additions & 3 deletions src/settings/controllers/LazyLoadingController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copied the code from UserSettings here as I the method there is used in a different use case, to not have this break when the method changes.

if (!PlatformPeg.get()) return;

MatrixClientPeg.get().stopClient();
await MatrixClientPeg.get().store.deleteAllData();
PlatformPeg.get().reload();
}
}