Skip to content

Commit df42a10

Browse files
committed
chore(files_sharing): lint & refactor fixes
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent 9b84831 commit df42a10

22 files changed

+34
-33
lines changed

apps/files/src/actions/moveOrCopyActionUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const getQueue = () => {
2424
}
2525

2626
type ShareAttribute = {
27-
value: any
27+
value: boolean|string|number|null|object|Array<unknown>
2828
key: string
2929
scope: string
3030
}

apps/files_sharing/lib/Controller/ShareAPIController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,7 @@ private function checkInheritedAttributes(IShare $share): void {
20592059
* Send a mail notification again for a share.
20602060
* The mail_send option must be enabled for the given share.
20612061
* @param string $id the share ID
2062-
* @param string $password optional, the password to check against. Necessary for password protected shares.
2062+
* @param string $password the password to check against. Necessary for password protected shares.
20632063
* @throws OCSNotFoundException Share not found
20642064
* @throws OCSForbiddenException You are not allowed to send mail notifications
20652065
* @throws OCSBadRequestException Invalid request or wrong password

apps/files_sharing/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2562,7 +2562,7 @@
25622562
"password": {
25632563
"type": "string",
25642564
"default": "",
2565-
"description": "optional, the password to check against. Necessary for password protected shares."
2565+
"description": "the password to check against. Necessary for password protected shares."
25662566
}
25672567
}
25682568
}

apps/files_sharing/src/components/NewFileRequestDialog.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<!-- Header -->
1515
<NcNoteCard v-show="currentStep === STEP.FIRST" type="info" class="file-request-dialog__header">
1616
<p id="file-request-dialog-description" class="file-request-dialog__description">
17-
{{ t('files_sharing', 'Collect files from others even if they don\'t have an account.') }}
17+
{{ t('files_sharing', 'Collect files from others even if they do not have an account.') }}
1818
{{ t('files_sharing', 'To ensure you can receive files, verify you have enough storage available.') }}
1919
</p>
2020
</NcNoteCard>
@@ -103,16 +103,14 @@
103103
</template>
104104

105105
<script lang="ts">
106-
// eslint-disable-next-line n/no-extraneous-import
107-
import type { AxiosError } from 'axios'
106+
import type { AxiosError } from '@nextcloud/axios'
108107
import type { Folder, Node } from '@nextcloud/files'
109108
import type { OCSResponse } from '@nextcloud/typings/ocs'
110109
import type { PropType } from 'vue'
111110
112111
import { defineComponent } from 'vue'
113112
import { emit } from '@nextcloud/event-bus'
114113
import { generateOcsUrl } from '@nextcloud/router'
115-
import { getCapabilities } from '@nextcloud/capabilities'
116114
import { Permission } from '@nextcloud/files'
117115
import { ShareType } from '@nextcloud/sharing'
118116
import { showError, showSuccess } from '@nextcloud/dialogs'
@@ -127,18 +125,21 @@ import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
127125
import IconCheck from 'vue-material-design-icons/Check.vue'
128126
import IconNext from 'vue-material-design-icons/ArrowRight.vue'
129127
128+
import Config from '../services/ConfigService'
130129
import FileRequestDatePassword from './NewFileRequestDialog/NewFileRequestDialogDatePassword.vue'
131130
import FileRequestFinish from './NewFileRequestDialog/NewFileRequestDialogFinish.vue'
132131
import FileRequestIntro from './NewFileRequestDialog/NewFileRequestDialogIntro.vue'
133-
import Share from '../models/Share'
134132
import logger from '../services/logger'
133+
import Share from '../models/Share'
135134
136135
enum STEP {
137136
FIRST = 0,
138137
SECOND = 1,
139138
LAST = 2,
140139
}
141140
141+
const sharingConfig = new Config()
142+
142143
export default defineComponent({
143144
name: 'NewFileRequestDialog',
144145
@@ -172,7 +173,7 @@ export default defineComponent({
172173
n: translatePlural,
173174
t: translate,
174175
175-
isShareByMailEnabled: getCapabilities()?.files_sharing?.sharebymail?.enabled === true,
176+
isShareByMailEnabled: sharingConfig.isMailShareAllowed,
176177
}
177178
},
178179
@@ -310,7 +311,7 @@ export default defineComponent({
310311
throw new Error('Share ID is missing')
311312
}
312313
313-
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares/' + this.share.id)
314+
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares/{id}', { id: this.share.id })
314315
try {
315316
// Convert link share to email share
316317
const request = await axios.put<OCSResponse>(shareUrl, {
@@ -341,7 +342,7 @@ export default defineComponent({
341342
throw new Error('Share ID is missing')
342343
}
343344
344-
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares/' + this.share.id + '/send-email')
345+
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares/{id}/send-email', { id: this.share.id })
345346
try {
346347
// Convert link share to email share
347348
const request = await axios.post<OCSResponse>(shareUrl, {

apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</NcNoteCard>
1818

1919
<!-- Enable expiration -->
20-
<legend>{{ t('files_sharing', 'When should the request expire ?') }}</legend>
20+
<legend>{{ t('files_sharing', 'When should the request expire?') }}</legend>
2121
<NcCheckboxRadioSwitch v-show="!defaultExpireDateEnforced"
2222
:checked="defaultExpireDateEnforced || expirationDate !== null"
2323
:disabled="disabled || defaultExpireDateEnforced"
@@ -47,7 +47,7 @@
4747
</NcNoteCard>
4848

4949
<!-- Enable password -->
50-
<legend>{{ t('files_sharing', 'What password should be used for the request ?') }}</legend>
50+
<legend>{{ t('files_sharing', 'What password should be used for the request?') }}</legend>
5151
<NcCheckboxRadioSwitch v-show="!enforcePasswordForPublicLink"
5252
:checked="enforcePasswordForPublicLink || password !== null"
5353
:disabled="disabled || enforcePasswordForPublicLink"

apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import type { PropType } from 'vue'
5959
import Share from '../../models/Share'
6060
6161
import { defineComponent } from 'vue'
62-
import { generateUrl } from '@nextcloud/router'
62+
import { generateUrl, getBaseUrl } from '@nextcloud/router'
6363
import { showError, showSuccess } from '@nextcloud/dialogs'
6464
import { translate, translatePlural } from '@nextcloud/l10n'
6565
@@ -118,7 +118,7 @@ export default defineComponent({
118118
119119
computed: {
120120
shareLink() {
121-
return window.location.protocol + '//' + window.location.host + generateUrl('/s/') + this.share.token
121+
return generateUrl('/s/{token}', { token: this.share.token }, { baseURL: getBaseUrl() })
122122
},
123123
},
124124

apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- Request label -->
99
<fieldset class="file-request-dialog__label" data-cy-file-request-dialog-fieldset="label">
1010
<legend>
11-
{{ t('files_sharing', 'What are you requesting ?') }}
11+
{{ t('files_sharing', 'What are you requesting?') }}
1212
</legend>
1313
<NcTextField :value="label"
1414
:disabled="disabled"
@@ -22,7 +22,7 @@
2222
<!-- Request destination -->
2323
<fieldset class="file-request-dialog__destination" data-cy-file-request-dialog-fieldset="destination">
2424
<legend>
25-
{{ t('files_sharing', 'Where should these files go ?') }}
25+
{{ t('files_sharing', 'Where should these files go?') }}
2626
</legend>
2727
<NcTextField :value="destination"
2828
:disabled="disabled"

dist/5693-5693.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/5693-5693.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)