Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions apps/settings/src/components/AuthToken.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
10 changes: 6 additions & 4 deletions apps/settings/src/components/AuthToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
12 changes: 6 additions & 6 deletions apps/settings/src/components/AuthTokenSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
-->

<template>
<div id="security" class="section">
<h2>{{ t('settings', 'Devices & sessions', {}, undefined, { sanitize: false }) }}</h2>
<p class="settings-hint hidden-when-empty">
{{ t('settings', 'Web, desktop and mobile clients currently logged in to your account.') }}
</p>
<NcSettingsSection
:name="t('settings', 'Devices & sessions', {}, undefined, { sanitize: false })"
:description="t('settings', 'Web, desktop and mobile clients currently logged in to your account.')">
<AuthTokenList />
<AuthTokenSetup v-if="canCreateToken" />
</div>
</NcSettingsSection>
</template>

<script lang="ts">
import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'
import { defineComponent } from 'vue'
import NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'
import AuthTokenList from './AuthTokenList.vue'
import AuthTokenSetup from './AuthTokenSetup.vue'

Expand All @@ -26,6 +25,7 @@ export default defineComponent({
components: {
AuthTokenList,
AuthTokenSetup,
NcSettingsSection,
},

data() {
Expand Down
4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-vue-settings-personal-security.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions dist/settings-vue-settings-personal-security.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ SPDX-FileCopyrightText: Evan You
SPDX-FileCopyrightText: Eduardo San Martin Morote
SPDX-FileCopyrightText: Dr.-Ing. Mario Heiderich, Cure53 <mario@cure53.de> (https://cure53.de/)
SPDX-FileCopyrightText: David Clark
SPDX-FileCopyrightText: Christoph Wurst
SPDX-FileCopyrightText: Chen Fengyuan
SPDX-FileCopyrightText: Austin Andrews
SPDX-FileCopyrightText: Anthony Fu <https://github.com/antfu>
Expand Down Expand Up @@ -151,6 +152,9 @@ This file is generated from multiple sources. Included packages:
- @nextcloud/router
- version: 3.1.0
- license: GPL-3.0-or-later
- @nextcloud/initial-state
- version: 2.2.0
- license: GPL-3.0-or-later
- focus-trap
- version: 7.8.0
- license: MIT
Expand Down
2 changes: 1 addition & 1 deletion dist/settings-vue-settings-personal-security.js.map

Large diffs are not rendered by default.

Loading