diff --git a/src/__mocks__/capabilities.ts b/src/__mocks__/capabilities.ts index 1646b320e7b..7cde0f3567c 100644 --- a/src/__mocks__/capabilities.ts +++ b/src/__mocks__/capabilities.ts @@ -134,6 +134,7 @@ export const mockedCapabilities: Capabilities = { conversations: { 'can-create': true, 'force-passwords': false, + 'compact-list': 0, }, federation: { enabled: false, @@ -167,6 +168,7 @@ export const mockedCapabilities: Capabilities = { ], conversations: [ 'can-create', + 'compact-list', ], federation: [], previews: [ diff --git a/src/components/SettingsDialog/SettingsDialog.vue b/src/components/SettingsDialog/SettingsDialog.vue index 5512d8cb099..430da31c25d 100644 --- a/src/components/SettingsDialog/SettingsDialog.vue +++ b/src/components/SettingsDialog/SettingsDialog.vue @@ -56,6 +56,19 @@ @close="showFilePicker = false" /> + + + {{ t('spreed', 'Show my conversations list in compact mode') }} + + { }) describe('media settings dialog', () => { + // FIXME: BrowserStorage.getItem('cachedConversations') is always called whenever capabilitiesManager.ts is imported + const EXTRA_CALLS = 3 it('shows correct stored values for conversations', () => { // Arrange settingsStore.showMediaSettings['token-1'] = true @@ -70,10 +72,7 @@ describe('settingsStore', () => { // Assert expect(results).toEqual([true, false]) - // It's always called at least once : BrowserStorage.getItem('cachedConversations') - // Whenever capabilitiesManager.ts is imported - // +2 - expect(BrowserStorage.getItem).toHaveBeenCalledTimes(2) + expect(BrowserStorage.getItem).toHaveBeenCalledTimes(EXTRA_CALLS) }) it('shows correct values received from BrowserStorage', () => { @@ -90,11 +89,10 @@ describe('settingsStore', () => { // Assert expect(results).toEqual([true, true, false]) - // It's always called at least once : BrowserStorage.getItem('cachedConversations') (+2) - expect(BrowserStorage.getItem).toHaveBeenCalledTimes(5) // 2 + 3 - expect(BrowserStorage.getItem).toHaveBeenNthCalledWith(3, 'showMediaSettings_token-1') - expect(BrowserStorage.getItem).toHaveBeenNthCalledWith(4, 'showMediaSettings_token-2') - expect(BrowserStorage.getItem).toHaveBeenNthCalledWith(5, 'showMediaSettings_token-3') + expect(BrowserStorage.getItem).toHaveBeenCalledTimes(EXTRA_CALLS + 3) + expect(BrowserStorage.getItem).toHaveBeenNthCalledWith(EXTRA_CALLS + 1, 'showMediaSettings_token-1') + expect(BrowserStorage.getItem).toHaveBeenNthCalledWith(EXTRA_CALLS + 2, 'showMediaSettings_token-2') + expect(BrowserStorage.getItem).toHaveBeenNthCalledWith(EXTRA_CALLS + 3, 'showMediaSettings_token-3') }) it('updates values correctly', async () => { @@ -110,8 +108,7 @@ describe('settingsStore', () => { // Assert expect(results).toEqual([false, true]) - // It's always called at least once : BrowserStorage.getItem('cachedConversations') (+2) - expect(BrowserStorage.getItem).toHaveBeenCalledTimes(2) + expect(BrowserStorage.getItem).toHaveBeenCalledTimes(EXTRA_CALLS) expect(BrowserStorage.setItem).toHaveBeenCalledTimes(2) expect(BrowserStorage.setItem).toHaveBeenNthCalledWith(1, 'showMediaSettings_token-1', 'false') expect(BrowserStorage.setItem).toHaveBeenNthCalledWith(2, 'showMediaSettings_token-2', 'true') diff --git a/src/stores/settings.js b/src/stores/settings.js index dc8e9e4ee0b..ad3c2def1df 100644 --- a/src/stores/settings.js +++ b/src/stores/settings.js @@ -16,6 +16,7 @@ import { setTypingStatusPrivacy, setStartWithoutMedia, setBlurVirtualBackground, + setConversationsListStyle, } from '../services/settingsService.ts' /** @@ -42,6 +43,7 @@ export const useSettingsStore = defineStore('settings', { showMediaSettings: {}, startWithoutMedia: getTalkConfig('local', 'call', 'start-without-media'), blurVirtualBackgroundEnabled: getTalkConfig('local', 'call', 'blur-virtual-background'), + conversationsListStyle: getTalkConfig('local', 'conversations', 'compact-list'), }), getters: { @@ -114,5 +116,10 @@ export const useSettingsStore = defineStore('settings', { await setStartWithoutMedia(value) this.startWithoutMedia = value }, + + async setConversationsListStyle(value) { + await setConversationsListStyle(value) + this.conversationsListStyle = value + }, }, })