diff options
Diffstat (limited to 'apps/settings')
-rw-r--r-- | apps/settings/src/admin.js | 9 | ||||
-rw-r--r-- | apps/settings/src/components/AuthToken.vue | 4 | ||||
-rw-r--r-- | apps/settings/src/components/BasicSettings/BackgroundJob.vue | 3 | ||||
-rw-r--r-- | apps/settings/src/components/Encryption.vue | 17 | ||||
-rw-r--r-- | apps/settings/src/components/Markdown.vue | 1 | ||||
-rw-r--r-- | apps/settings/src/components/PersonalInfo/BirthdaySection.vue | 14 | ||||
-rw-r--r-- | apps/settings/src/components/PersonalInfo/DetailsSection.vue | 12 | ||||
-rw-r--r-- | apps/settings/src/components/Users/NewUserDialog.vue | 3 | ||||
-rw-r--r-- | apps/settings/src/main-apps-users-management.ts | 13 | ||||
-rw-r--r-- | apps/settings/src/main-declarative-settings-forms.ts | 10 | ||||
-rw-r--r-- | apps/settings/src/mixins/UserRowMixin.js | 12 | ||||
-rw-r--r-- | apps/settings/src/utils/userUtils.ts | 4 |
12 files changed, 55 insertions, 47 deletions
diff --git a/apps/settings/src/admin.js b/apps/settings/src/admin.js index 88b32f941a5..52778aec7df 100644 --- a/apps/settings/src/admin.js +++ b/apps/settings/src/admin.js @@ -3,11 +3,12 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +import { generateUrl } from '@nextcloud/router' import $ from 'jquery' window.addEventListener('DOMContentLoaded', () => { $('#loglevel').change(function() { - $.post(OC.generateUrl('/settings/admin/log/level'), { level: $(this).val() }, () => { + $.post(generateUrl('/settings/admin/log/level'), { level: $(this).val() }, () => { OC.Log.reload() }) }) @@ -48,7 +49,7 @@ window.addEventListener('DOMContentLoaded', () => { OC.msg.startSaving('#mail_settings_msg') $.ajax({ - url: OC.generateUrl('/settings/admin/mailsettings'), + url: generateUrl('/settings/admin/mailsettings'), type: 'POST', data: $('#mail_general_settings_form').serialize(), success: () => { @@ -68,7 +69,7 @@ window.addEventListener('DOMContentLoaded', () => { OC.msg.startSaving('#mail_settings_msg') $.ajax({ - url: OC.generateUrl('/settings/admin/mailsettings/credentials'), + url: generateUrl('/settings/admin/mailsettings/credentials'), type: 'POST', data: $('#mail_credentials_settings').serialize(), success: () => { @@ -94,7 +95,7 @@ window.addEventListener('DOMContentLoaded', () => { OC.msg.startAction('#sendtestmail_msg', t('settings', 'Sending…')) $.ajax({ - url: OC.generateUrl('/settings/admin/mailtest'), + url: generateUrl('/settings/admin/mailtest'), type: 'POST', success: () => { OC.msg.finishedSuccess('#sendtestmail_msg', t('settings', 'Email sent')) diff --git a/apps/settings/src/components/AuthToken.vue b/apps/settings/src/components/AuthToken.vue index 2efe2db4145..9e77d8b3749 100644 --- a/apps/settings/src/components/AuthToken.vue +++ b/apps/settings/src/components/AuthToken.vue @@ -175,8 +175,8 @@ export default defineComponent({ return this.token.type === TokenType.PERMANENT_TOKEN }, /** - * Object ob the current user agend used by the token - * @return Either an object containing user agent information or null if unknown + * Object ob the current user agent used by the token + * This either returns an object containing user agent information or `null` if unknown */ client() { // pretty format sync client user agent diff --git a/apps/settings/src/components/BasicSettings/BackgroundJob.vue b/apps/settings/src/components/BasicSettings/BackgroundJob.vue index 835f65a2477..4924014b78a 100644 --- a/apps/settings/src/components/BasicSettings/BackgroundJob.vue +++ b/apps/settings/src/components/BasicSettings/BackgroundJob.vue @@ -56,6 +56,7 @@ @update:checked="onBackgroundJobModeChanged"> {{ t('settings', 'Cron (Recommended)') }} </NcCheckboxRadioSwitch> + <!-- eslint-disable-next-line vue/no-v-html The translation is sanitized--> <em v-html="cronLabel" /> </NcSettingsSection> </template> @@ -111,7 +112,7 @@ export default { desc += '<br>' + t('settings', 'The PHP POSIX extension is required. See {linkstart}PHP documentation{linkend} for more details.', { linkstart: '<a target="_blank" rel="noreferrer nofollow" class="external" href="https://www.php.net/manual/en/book.posix.php">', linkend: '</a>', - }, undefined, { escape: false, sanitize: false }) + }, undefined, { escape: false }) } return desc }, diff --git a/apps/settings/src/components/Encryption.vue b/apps/settings/src/components/Encryption.vue index 72b597c61d3..4d80f9b9833 100644 --- a/apps/settings/src/components/Encryption.vue +++ b/apps/settings/src/components/Encryption.vue @@ -53,7 +53,15 @@ </template> </div> - <div v-else-if="externalBackendsEnabled" v-html="migrationMessage" /> + <div v-else-if="externalBackendsEnabled"> + {{ + t( + 'settings', + 'You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "Default encryption module" and run {command}', + { command: '"occ encryption:migrate"' }, + ) + }} + </div> </div> </NcSettingsSection> </template> @@ -92,13 +100,6 @@ export default { defaultCheckedModule: Object.entries(encryptionModules).find((module) => module[1].default)[0], } }, - computed: { - migrationMessage() { - return t('settings', 'You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "Default encryption module" and run {command}', { - command: '"occ encryption:migrate"', - }) - }, - }, methods: { displayWarning() { if (!this.encryptionEnabled) { diff --git a/apps/settings/src/components/Markdown.vue b/apps/settings/src/components/Markdown.vue index f3b8747119d..dc7a076a700 100644 --- a/apps/settings/src/components/Markdown.vue +++ b/apps/settings/src/components/Markdown.vue @@ -4,6 +4,7 @@ --> <template> + <!-- eslint-disable-next-line vue/no-v-html This is rendered markdown so should be "safe" --> <div class="settings-markdown" v-html="renderMarkdown" /> </template> diff --git a/apps/settings/src/components/PersonalInfo/BirthdaySection.vue b/apps/settings/src/components/PersonalInfo/BirthdaySection.vue index 86917257600..633794d9d5d 100644 --- a/apps/settings/src/components/PersonalInfo/BirthdaySection.vue +++ b/apps/settings/src/components/PersonalInfo/BirthdaySection.vue @@ -8,13 +8,11 @@ :input-id="inputId" :readable="birthdate.readable" /> - <template> - <NcDateTimePickerNative :id="inputId" - type="date" - label="" - :value="value" - @input="onInput" /> - </template> + <NcDateTimePickerNative :id="inputId" + type="date" + label="" + :value="value" + @input="onInput" /> <p class="property__helper-text-message"> {{ t('settings', 'Enter your date of birth') }} @@ -66,7 +64,7 @@ export default { get() { return new Date(this.birthdate.value) }, - /** @param {Date} value */ + /** @param {Date} value The date to set */ set(value) { const day = value.getDate().toString().padStart(2, '0') const month = (value.getMonth() + 1).toString().padStart(2, '0') diff --git a/apps/settings/src/components/PersonalInfo/DetailsSection.vue b/apps/settings/src/components/PersonalInfo/DetailsSection.vue index a69b6d58ed7..a5de95f7ee5 100644 --- a/apps/settings/src/components/PersonalInfo/DetailsSection.vue +++ b/apps/settings/src/components/PersonalInfo/DetailsSection.vue @@ -20,6 +20,7 @@ <div class="details__quota"> <CircleSlice :size="20" /> <div class="details__quota-info"> + <!-- eslint-disable-next-line vue/no-v-html --> <p class="details__quota-text" v-html="quotaText" /> <NcProgressBar size="medium" :value="usageRelative" @@ -32,8 +33,9 @@ <script> import { loadState } from '@nextcloud/initial-state' -import NcProgressBar from '@nextcloud/vue/dist/Components/NcProgressBar.js' +import { t } from '@nextcloud/l10n' +import NcProgressBar from '@nextcloud/vue/dist/Components/NcProgressBar.js' import Account from 'vue-material-design-icons/Account.vue' import CircleSlice from 'vue-material-design-icons/CircleSlice3.vue' @@ -64,12 +66,14 @@ export default { computed: { quotaText() { if (quota === SPACE_UNLIMITED) { - return t('settings', 'You are using <strong>{usage}</strong>', { usage }) + return t('settings', 'You are using {s}{usage}{/s}', { usage, s: '<strong>', '/s': '</strong>' }, undefined, { escape: false }) } return t( 'settings', - 'You are using <strong>{usage}</strong> of <strong>{totalSpace}</strong> (<strong>{usageRelative}%</strong>)', - { usage, totalSpace, usageRelative }, + 'You are using {s}{usage}{/s} of {s}{totalSpace}{/s} ({s}{usageRelative}%{/s})', + { usage, totalSpace, usageRelative, s: '<strong>', '/s': '</strong>' }, + undefined, + { escape: false }, ) }, }, diff --git a/apps/settings/src/components/Users/NewUserDialog.vue b/apps/settings/src/components/Users/NewUserDialog.vue index bc6ba0901d9..26e4afbd924 100644 --- a/apps/settings/src/components/Users/NewUserDialog.vue +++ b/apps/settings/src/components/Users/NewUserDialog.vue @@ -135,6 +135,7 @@ </template> <script> +import { formatFileSize, parseFileSize } from '@nextcloud/files' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' import NcDialog from '@nextcloud/vue/dist/Components/NcDialog.js' import NcPasswordField from '@nextcloud/vue/dist/Components/NcPasswordField.js' @@ -317,7 +318,7 @@ export default { const validQuota = OC.Util.computerFileSize(quota) if (validQuota !== null && validQuota >= 0) { // unify format output - quota = OC.Util.humanFileSize(OC.Util.computerFileSize(quota)) + quota = formatFileSize(parseFileSize(quota)) this.newUser.quota = { id: quota, label: quota } return this.newUser.quota } diff --git a/apps/settings/src/main-apps-users-management.ts b/apps/settings/src/main-apps-users-management.ts index c923406ce7f..f24562d3e82 100644 --- a/apps/settings/src/main-apps-users-management.ts +++ b/apps/settings/src/main-apps-users-management.ts @@ -4,9 +4,9 @@ */ import Vue from 'vue' -import VTooltip from 'v-tooltip' +import VTooltipPlugin from 'v-tooltip' import { sync } from 'vuex-router-sync' -import { translate as t, translatePlural as n } from '@nextcloud/l10n' +import { t, n } from '@nextcloud/l10n' import SettingsApp from './views/SettingsApp.vue' import router from './router/index.ts' @@ -14,19 +14,18 @@ import { useStore } from './store/index.js' import { getCSPNonce } from '@nextcloud/auth' import { PiniaVuePlugin, createPinia } from 'pinia' -Vue.use(VTooltip, { defaultHtml: false }) - -const store = useStore() -sync(store, router) - // CSP config for webpack dynamic chunk loading // eslint-disable-next-line camelcase __webpack_nonce__ = getCSPNonce() +const store = useStore() +sync(store, router) + // bind to window Vue.prototype.t = t Vue.prototype.n = n Vue.use(PiniaVuePlugin) +Vue.use(VTooltipPlugin, { defaultHtml: false }) const pinia = createPinia() diff --git a/apps/settings/src/main-declarative-settings-forms.ts b/apps/settings/src/main-declarative-settings-forms.ts index 7cd4cb68345..6e2d71b69ca 100644 --- a/apps/settings/src/main-declarative-settings-forms.ts +++ b/apps/settings/src/main-declarative-settings-forms.ts @@ -5,9 +5,10 @@ import type { ComponentInstance } from 'vue' import { loadState } from '@nextcloud/initial-state' -import { translate as t, translatePlural as n } from '@nextcloud/l10n' +import { t, n } from '@nextcloud/l10n' import Vue from 'vue' import DeclarativeSection from './components/DeclarativeSettings/DeclarativeSection.vue' +import logger from './logger' interface DeclarativeFormField { id: string, @@ -34,12 +35,10 @@ interface DeclarativeForm { fields: Array<DeclarativeFormField>, } -const forms = loadState('settings', 'declarative-settings-forms', []) as Array<DeclarativeForm> -console.debug('Loaded declarative forms:', forms) +const forms = loadState<DeclarativeForm[]>('settings', 'declarative-settings-forms', []) /** - * - * @param forms + * @param forms The forms to render */ function renderDeclarativeSettingsSections(forms: Array<DeclarativeForm>): ComponentInstance[] { Vue.mixin({ methods: { t, n } }) @@ -57,5 +56,6 @@ function renderDeclarativeSettingsSections(forms: Array<DeclarativeForm>): Compo } document.addEventListener('DOMContentLoaded', () => { + logger.debug('Loaded declarative forms', { forms }) renderDeclarativeSettingsSections(forms) }) diff --git a/apps/settings/src/mixins/UserRowMixin.js b/apps/settings/src/mixins/UserRowMixin.js index a06b310bcca..6ed29cf0049 100644 --- a/apps/settings/src/mixins/UserRowMixin.js +++ b/apps/settings/src/mixins/UserRowMixin.js @@ -3,6 +3,8 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +import { formatFileSize } from '@nextcloud/files' + export default { props: { user: { @@ -68,11 +70,10 @@ export default { /* QUOTA MANAGEMENT */ usedSpace() { - if (this.user.quota.used) { - return t('settings', '{size} used', { size: OC.Util.humanFileSize(this.user.quota.used) }) - } - return t('settings', '{size} used', { size: OC.Util.humanFileSize(0) }) + const quotaUsed = this.user.quota.used > 0 ? this.user.quota.used : 0 + return t('settings', '{size} used', { size: formatFileSize(quotaUsed, true) }) }, + usedQuota() { let quota = this.user.quota.quota if (quota > 0) { @@ -84,11 +85,12 @@ export default { } return isNaN(quota) ? 0 : quota }, + // Mapping saved values to objects userQuota() { if (this.user.quota.quota >= 0) { // if value is valid, let's map the quotaOptions or return custom quota - const humanQuota = OC.Util.humanFileSize(this.user.quota.quota) + const humanQuota = formatFileSize(this.user.quota.quota) const userQuota = this.quotaOptions.find(quota => quota.id === humanQuota) return userQuota || { id: humanQuota, label: humanQuota } } else if (this.user.quota.quota === 'default') { diff --git a/apps/settings/src/utils/userUtils.ts b/apps/settings/src/utils/userUtils.ts index 9ac21fd4c0e..7d9a516a542 100644 --- a/apps/settings/src/utils/userUtils.ts +++ b/apps/settings/src/utils/userUtils.ts @@ -18,8 +18,8 @@ export const defaultQuota = { /** * Return `true` if the logged in user does not have permissions to view the * data of `user` - * @param user - * @param user.id + * @param user The user to check + * @param user.id Id of the user */ export const isObfuscated = (user: { id: string, [key: string]: unknown }) => { const keys = Object.keys(user) |