fix: message preview toggle is inverted in room list header (#31865)

This commit is contained in:
Florian Duros 2026-01-23 12:17:22 +01:00 committed by GitHub
parent c135c16824
commit 26779b10bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -189,8 +189,8 @@ export class RoomListHeaderViewModel
public toggleMessagePreview = (): void => {
PosthogTrackers.trackInteraction("WebRoomListMessagePreviewToggle");
const isMessagePreviewEnabled = SettingsStore.getValue("RoomList.showMessagePreview");
SettingsStore.setValue("RoomList.showMessagePreview", null, SettingLevel.DEVICE, !isMessagePreviewEnabled);
const isMessagePreviewEnabled = !SettingsStore.getValue("RoomList.showMessagePreview");
SettingsStore.setValue("RoomList.showMessagePreview", null, SettingLevel.DEVICE, isMessagePreviewEnabled);
this.snapshot.merge({ isMessagePreviewEnabled });
};
}

View File

@ -293,6 +293,7 @@ describe("RoomListHeaderViewModel", () => {
vm.toggleMessagePreview();
expect(setValueSpy).toHaveBeenCalledWith("RoomList.showMessagePreview", null, expect.anything(), false);
expect(vm.getSnapshot().isMessagePreviewEnabled).toBe(false);
});
});
});