make some tests go happy

This commit is contained in:
Half-Shot
2025-04-08 11:59:11 +01:00
parent 35503035e2
commit 2b6151f678
17 changed files with 505 additions and 348 deletions

View File

@@ -374,6 +374,10 @@ export default class SettingsStore {
roomId: string | null = null,
excludeDefault = false,
): Settings[S]["default"] | undefined {
if (settingName === "mediaPreviewConfig") {
console.log("GET VALUE", SETTINGS[settingName]);
}
// Verify that the setting is actually a setting
if (!SETTINGS[settingName]) {
throw new Error("Setting '" + settingName + "' does not appear to be a setting.");
@@ -382,6 +386,7 @@ export default class SettingsStore {
const setting = SETTINGS[settingName];
const levelOrder = getLevelOrder(setting);
return SettingsStore.getValueAt(levelOrder[0], settingName, roomId, false, excludeDefault);
}
@@ -728,8 +733,9 @@ export default class SettingsStore {
const showImages = handler.getValue("showImages", null);
const showAvatarsOnInvites = handler.getValue("showAvatarsOnInvites", null);
const AccountHandler = LEVEL_HANDLERS[SettingLevel.ACCOUNT];
if (showImages !== null || showAvatarsOnInvites !== null) {
this.setValue("mediaPreviewConfig", null, SettingLevel.ACCOUNT, {
AccountHandler.setValue("mediaPreviewConfig", null, {
invite_avatars: showAvatarsOnInvites === false ? MediaPreviewValue.Off : MediaPreviewValue.On,
media_previews: showImages === false ? MediaPreviewValue.Off : MediaPreviewValue.On,
});