check if server supports lazy loading before enabling
parent
94c424d3bb
commit
84b74247e6
|
@ -847,7 +847,7 @@ module.exports = React.createClass({
|
||||||
const onChange = async (e) => {
|
const onChange = async (e) => {
|
||||||
const checked = e.target.checked;
|
const checked = e.target.checked;
|
||||||
if (featureId === "feature_lazyloading") {
|
if (featureId === "feature_lazyloading") {
|
||||||
const confirmed = await this._onLazyLoadChanging();
|
const confirmed = await this._onLazyLoadChanging(checked);
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
|
@ -886,9 +886,28 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLazyLoadChanging: function() {
|
_onLazyLoadChanging: async function(enabling) {
|
||||||
return new Promise((resolve) => {
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
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) => {
|
||||||
|
Modal.createDialog(QuestionDialog, {
|
||||||
|
title: _t("Lazy loading members not supported"),
|
||||||
|
description:
|
||||||
|
<div>
|
||||||
|
{ _t("Lazy loading is not supported by your " +
|
||||||
|
"current homeserver.") }
|
||||||
|
</div>,
|
||||||
|
button: _t("OK"),
|
||||||
|
onFinished: resolve,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const confirmed = await new Promise((resolve) => {
|
||||||
Modal.createDialog(QuestionDialog, {
|
Modal.createDialog(QuestionDialog, {
|
||||||
title: _t("Turn on/off lazy load members"),
|
title: _t("Turn on/off lazy load members"),
|
||||||
description:
|
description:
|
||||||
|
@ -909,6 +928,7 @@ module.exports = React.createClass({
|
||||||
onFinished: resolve,
|
onFinished: resolve,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
return confirmed;
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderDeactivateAccount: function() {
|
_renderDeactivateAccount: function() {
|
||||||
|
|
|
@ -1220,5 +1220,7 @@
|
||||||
"Increase performance by only loading room members on first view": "Increase performance by only loading room members on first view",
|
"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",
|
"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.",
|
"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"
|
"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."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue