Skip to content

Commit

Permalink
chore(files_sharing): lint & refactor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Jul 12, 2024
1 parent b55bc69 commit 7d41921
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion apps/files/src/actions/moveOrCopyActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const getQueue = () => {
}

type ShareAttribute = {
value: any
value: boolean|string|number|null|object|Array<unknown>
key: string
scope: string
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2059,7 +2059,7 @@ private function checkInheritedAttributes(IShare $share): void {
* 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
Expand Down
17 changes: 9 additions & 8 deletions apps/files_sharing/src/components/NewFileRequestDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -103,16 +103,14 @@
</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'
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'
Expand All @@ -127,18 +125,21 @@ 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,
SECOND = 1,
LAST = 2,
}
const sharingConfig = new Config()
export default defineComponent({
name: 'NewFileRequestDialog',
Expand Down Expand Up @@ -172,7 +173,7 @@ export default defineComponent({
n: translatePlural,
t: translate,
isShareByMailEnabled: getCapabilities()?.files_sharing?.sharebymail?.enabled === true,
isShareByMailEnabled: sharingConfig.isMailShareAllowed,
}
},
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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() })
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions dist/5693-5693.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/5693-5693.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/5693-5693.js.map.license
2 changes: 0 additions & 2 deletions dist/6303-6303.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/6303-6303.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/6303-6303.js.map.license

This file was deleted.

4 changes: 2 additions & 2 deletions dist/core-files_fileinfo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/files-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-init.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_sharing-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-init.js.map

Large diffs are not rendered by default.

0 comments on commit 7d41921

Please sign in to comment.