From e08d48acff8f1d3f47d96a0c4d812ca2f9ade3cd Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 4 Aug 2026 16:22:08 +0200 Subject: [PATCH] fix: Port away from removed oc_default Signed-off-by: Carl Schwan --- apps/settings/src/components/AuthToken.spec.ts | 12 ++++++------ apps/settings/src/components/AuthToken.vue | 10 ++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/settings/src/components/AuthToken.spec.ts b/apps/settings/src/components/AuthToken.spec.ts index ad561894ec8..75b483247f6 100644 --- a/apps/settings/src/components/AuthToken.spec.ts +++ b/apps/settings/src/components/AuthToken.spec.ts @@ -3,19 +3,19 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +import type { IToken } from '../store/authtoken.ts' + import { createTestingPinia } from '@pinia/testing' import { mount } from '@vue/test-utils' import { beforeEach, describe, expect, it, vi } from 'vitest' -// AuthToken.vue reads window.oc_defaults at module evaluation time. vi.hoisted -// runs before imports, so this guarantees the property is set on the existing -// jsdom window before the SFC is first parsed. +// AuthToken.vue reads window.OC.theme.productName at module evaluation time. +// vi.hoisted runs before imports, so this guarantees the property is set on +// the existing jsdom window before the SFC is first parsed. vi.hoisted(() => { - (window as unknown as { oc_defaults: { productName: string } }).oc_defaults = { productName: 'Nextcloud' } + (window as unknown as { OC: { theme: { productName: string } } }).OC.theme = { productName: 'Nextcloud' } }) -import type { IToken } from '../store/authtoken.ts' - // Mock @nextcloud/dialogs so the wipe action's showConfirmation call resolves // synchronously in tests. Hoisted so it's installed before AuthToken.vue imports. const showConfirmationMock = vi.hoisted(() => vi.fn()) diff --git a/apps/settings/src/components/AuthToken.vue b/apps/settings/src/components/AuthToken.vue index 59f733f59c1..716ed27edb0 100644 --- a/apps/settings/src/components/AuthToken.vue +++ b/apps/settings/src/components/AuthToken.vue @@ -109,6 +109,8 @@ import AuthTokenDeleteDialog from './AuthTokenDeleteDialog.vue' import { TokenType, useAuthTokenStore } from '../store/authtoken.ts' import { detect } from '../utils/userAgentDetect.ts' +const productName = window.OC.theme.productName as string + const nameMap = { edge: 'Microsoft Edge', firefox: 'Firefox', @@ -117,10 +119,10 @@ const nameMap = { androidChrome: t('settings', 'Google Chrome for Android'), iphone: 'iPhone', ipad: 'iPad', - iosClient: t('settings', '{productName} iOS app', { productName: window.oc_defaults.productName }), - androidClient: t('settings', '{productName} Android app', { productName: window.oc_defaults.productName }), - iosTalkClient: t('settings', '{productName} Talk for iOS', { productName: window.oc_defaults.productName }), - androidTalkClient: t('settings', '{productName} Talk for Android', { productName: window.oc_defaults.productName }), + iosClient: t('settings', '{productName} iOS app', { productName }), + androidClient: t('settings', '{productName} Android app', { productName }), + iosTalkClient: t('settings', '{productName} Talk for iOS', { productName }), + androidTalkClient: t('settings', '{productName} Talk for Android', { productName }), syncClient: t('settings', 'Sync client'), davx5: 'DAVx5', webPirate: 'WebPirate',