Skip to content

Commit 0cfff73

Browse files
committed
Cleanup nonsense
1 parent 461185b commit 0cfff73

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

apps/web/src/settings/Settings.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,11 +1151,8 @@ export const SETTINGS: Settings = {
11511151
displayName: _td("settings|inline_url_previews_default"),
11521152
default: true,
11531153
controller: new RequiresSettingsController([UIFeature.URLPreviews], false, (c) => {
1154-
if (
1155-
c["io.element.msc4452.preview_url"]?.enabled === undefined ||
1156-
c["io.element.msc4452.preview_url"].enabled
1157-
) {
1158-
// If there is no capability, assume true.
1154+
if (c["io.element.msc4452.preview_url"]?.enabled !== false) {
1155+
// If the capability is not listed, or explicitly true then do not disable.
11591156
return false;
11601157
}
11611158
return _t("common|disabled_by_homeserver");

apps/web/src/settings/controllers/RequiresSettingsController.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export default class RequiresSettingsController extends MatrixClientBackedContro
3636
}
3737
}
3838

39+
/**
40+
* Checks if the `isCapabilityDisabled` function blocks the setting.
41+
* @returns `true` or a string if the feature is disabled by the feature, otherwise false.
42+
*/
3943
private get isBlockedByCapabilites(): boolean | string {
4044
if (!this.isCapabilityDisabled) {
4145
return false;
@@ -44,7 +48,7 @@ export default class RequiresSettingsController extends MatrixClientBackedContro
4448
// at least one call to get capaibilies.
4549
const cachedCaps = this.client?.getCachedCapabilities();
4650
if (!cachedCaps) {
47-
// return forced value if caps aren't available yet.
51+
// If we do not have any capabilites yet, then assume the setting IS blocked.
4852
return true;
4953
}
5054
return this.isCapabilityDisabled(cachedCaps);

0 commit comments

Comments
 (0)