diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2024-07-12 15:11:10 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-07-12 20:14:30 +0200 |
commit | df42a10e56d2fd0721c97c8ef4ba4d8eadcea6af (patch) | |
tree | ce6a076cd90fa3afb0407cf552e7886156324d55 /apps | |
parent | 9b84831c8d0c1d715cd42fa3e4e01ac8a59fa369 (diff) | |
download | nextcloud-server-df42a10e56d2fd0721c97c8ef4ba4d8eadcea6af.tar.gz nextcloud-server-df42a10e56d2fd0721c97c8ef4ba4d8eadcea6af.zip |
chore(files_sharing): lint & refactor fixes
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
7 files changed, 18 insertions, 17 deletions
diff --git a/apps/files/src/actions/moveOrCopyActionUtils.ts b/apps/files/src/actions/moveOrCopyActionUtils.ts index 2092087cd9b..091df56e655 100644 --- a/apps/files/src/actions/moveOrCopyActionUtils.ts +++ b/apps/files/src/actions/moveOrCopyActionUtils.ts @@ -24,7 +24,7 @@ export const getQueue = () => { } type ShareAttribute = { - value: any + value: boolean|string|number|null|object|Array<unknown> key: string scope: string } diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 4b044450957..1ba4d441bc0 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -2059,7 +2059,7 @@ class ShareAPIController extends OCSController { * Send a mail notification again for a share. * The mail_send option must be enabled for the given share. * @param string $id the share ID - * @param string $password optional, the password to check against. Necessary for password protected shares. + * @param string $password the password to check against. Necessary for password protected shares. * @throws OCSNotFoundException Share not found * @throws OCSForbiddenException You are not allowed to send mail notifications * @throws OCSBadRequestException Invalid request or wrong password diff --git a/apps/files_sharing/openapi.json b/apps/files_sharing/openapi.json index 8669fdcc8e1..cf1e7206d01 100644 --- a/apps/files_sharing/openapi.json +++ b/apps/files_sharing/openapi.json @@ -2562,7 +2562,7 @@ "password": { "type": "string", "default": "", - "description": "optional, the password to check against. Necessary for password protected shares." + "description": "the password to check against. Necessary for password protected shares." } } } diff --git a/apps/files_sharing/src/components/NewFileRequestDialog.vue b/apps/files_sharing/src/components/NewFileRequestDialog.vue index 6f5044d21e5..31bca5d045b 100644 --- a/apps/files_sharing/src/components/NewFileRequestDialog.vue +++ b/apps/files_sharing/src/components/NewFileRequestDialog.vue @@ -14,7 +14,7 @@ <!-- Header --> <NcNoteCard v-show="currentStep === STEP.FIRST" type="info" class="file-request-dialog__header"> <p id="file-request-dialog-description" class="file-request-dialog__description"> - {{ t('files_sharing', 'Collect files from others even if they don\'t have an account.') }} + {{ t('files_sharing', 'Collect files from others even if they do not have an account.') }} {{ t('files_sharing', 'To ensure you can receive files, verify you have enough storage available.') }} </p> </NcNoteCard> @@ -103,8 +103,7 @@ </template> <script lang="ts"> -// eslint-disable-next-line n/no-extraneous-import -import type { AxiosError } from 'axios' +import type { AxiosError } from '@nextcloud/axios' import type { Folder, Node } from '@nextcloud/files' import type { OCSResponse } from '@nextcloud/typings/ocs' import type { PropType } from 'vue' @@ -112,7 +111,6 @@ import type { PropType } from 'vue' import { defineComponent } from 'vue' import { emit } from '@nextcloud/event-bus' import { generateOcsUrl } from '@nextcloud/router' -import { getCapabilities } from '@nextcloud/capabilities' import { Permission } from '@nextcloud/files' import { ShareType } from '@nextcloud/sharing' import { showError, showSuccess } from '@nextcloud/dialogs' @@ -127,11 +125,12 @@ import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js' import IconCheck from 'vue-material-design-icons/Check.vue' import IconNext from 'vue-material-design-icons/ArrowRight.vue' +import Config from '../services/ConfigService' import FileRequestDatePassword from './NewFileRequestDialog/NewFileRequestDialogDatePassword.vue' import FileRequestFinish from './NewFileRequestDialog/NewFileRequestDialogFinish.vue' import FileRequestIntro from './NewFileRequestDialog/NewFileRequestDialogIntro.vue' -import Share from '../models/Share' import logger from '../services/logger' +import Share from '../models/Share' enum STEP { FIRST = 0, @@ -139,6 +138,8 @@ enum STEP { LAST = 2, } +const sharingConfig = new Config() + export default defineComponent({ name: 'NewFileRequestDialog', @@ -172,7 +173,7 @@ export default defineComponent({ n: translatePlural, t: translate, - isShareByMailEnabled: getCapabilities()?.files_sharing?.sharebymail?.enabled === true, + isShareByMailEnabled: sharingConfig.isMailShareAllowed, } }, @@ -310,7 +311,7 @@ export default defineComponent({ throw new Error('Share ID is missing') } - const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares/' + this.share.id) + const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares/{id}', { id: this.share.id }) try { // Convert link share to email share const request = await axios.put<OCSResponse>(shareUrl, { @@ -341,7 +342,7 @@ export default defineComponent({ throw new Error('Share ID is missing') } - const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares/' + this.share.id + '/send-email') + const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares/{id}/send-email', { id: this.share.id }) try { // Convert link share to email share const request = await axios.post<OCSResponse>(shareUrl, { diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue index 651f2a52efe..58a5b5fd0d6 100644 --- a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue +++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue @@ -17,7 +17,7 @@ </NcNoteCard> <!-- Enable expiration --> - <legend>{{ t('files_sharing', 'When should the request expire ?') }}</legend> + <legend>{{ t('files_sharing', 'When should the request expire?') }}</legend> <NcCheckboxRadioSwitch v-show="!defaultExpireDateEnforced" :checked="defaultExpireDateEnforced || expirationDate !== null" :disabled="disabled || defaultExpireDateEnforced" @@ -47,7 +47,7 @@ </NcNoteCard> <!-- Enable password --> - <legend>{{ t('files_sharing', 'What password should be used for the request ?') }}</legend> + <legend>{{ t('files_sharing', 'What password should be used for the request?') }}</legend> <NcCheckboxRadioSwitch v-show="!enforcePasswordForPublicLink" :checked="enforcePasswordForPublicLink || password !== null" :disabled="disabled || enforcePasswordForPublicLink" diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue index 1fac6444a2a..a761e1150aa 100644 --- a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue +++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue @@ -59,7 +59,7 @@ import type { PropType } from 'vue' import Share from '../../models/Share' import { defineComponent } from 'vue' -import { generateUrl } from '@nextcloud/router' +import { generateUrl, getBaseUrl } from '@nextcloud/router' import { showError, showSuccess } from '@nextcloud/dialogs' import { translate, translatePlural } from '@nextcloud/l10n' @@ -118,7 +118,7 @@ export default defineComponent({ computed: { shareLink() { - return window.location.protocol + '//' + window.location.host + generateUrl('/s/') + this.share.token + return generateUrl('/s/{token}', { token: this.share.token }, { baseURL: getBaseUrl() }) }, }, diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue index 858406b1fd0..57b03289661 100644 --- a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue +++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue @@ -8,7 +8,7 @@ <!-- Request label --> <fieldset class="file-request-dialog__label" data-cy-file-request-dialog-fieldset="label"> <legend> - {{ t('files_sharing', 'What are you requesting ?') }} + {{ t('files_sharing', 'What are you requesting?') }} </legend> <NcTextField :value="label" :disabled="disabled" @@ -22,7 +22,7 @@ <!-- Request destination --> <fieldset class="file-request-dialog__destination" data-cy-file-request-dialog-fieldset="destination"> <legend> - {{ t('files_sharing', 'Where should these files go ?') }} + {{ t('files_sharing', 'Where should these files go?') }} </legend> <NcTextField :value="destination" :disabled="disabled" |