]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files_sharing): default empty file request expiration
authorskjnldsv <skjnldsv@protonmail.com>
Fri, 19 Jul 2024 10:01:55 +0000 (12:01 +0200)
committerskjnldsv <skjnldsv@protonmail.com>
Fri, 19 Jul 2024 10:01:55 +0000 (12:01 +0200)
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
apps/files_sharing/src/components/NewFileRequestDialog.vue
apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue
apps/files_sharing/src/new/newFileRequest.ts

index 6b0bb5a1fc22142f550bfdb00b22d97646db29d3..bdcaf1d90bff8957dd1de6d0542c9aacc62b7637 100644 (file)
@@ -270,19 +270,15 @@ export default defineComponent({
                async createShare() {
                        this.loading = true
 
-                       // This should never happen™
-                       if (this.expirationDate == null) {
-                               throw new Error('Expiration date is missing')
+                       let expireDate = ''
+                       if (this.expirationDate) {
+                               const year = this.expirationDate.getFullYear()
+                               const month = (this.expirationDate.getMonth() + 1).toString().padStart(2, '0')
+                               const day = this.expirationDate.getDate().toString().padStart(2, '0')
+
+                               // Format must be YYYY-MM-DD
+                               expireDate = `${year}-${month}-${day}`
                        }
-
-                       const year = this.expirationDate.getFullYear()
-                       const month = (this.expirationDate.getMonth() + 1).toString().padStart(2, '0')
-                       const day = this.expirationDate.getDate().toString().padStart(2, '0')
-
-                       // Format must be YYYY-MM-DD
-                       const expireDate = this.expirationDate
-                               ? `${year}-${month}-${day}`
-                               : undefined
                        const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares')
                        try {
                                const request = await axios.post<OCSResponse>(shareUrl, {
@@ -296,7 +292,7 @@ export default defineComponent({
                                        note: this.note,
 
                                        password: this.password || undefined,
-                                       expireDate,
+                                       expireDate: expireDate || undefined,
 
                                        // Empty string
                                        shareWith: '',
index 0eb89388122e06d5bc3104181d447eb9605019ed..091679ae5c44f1452985df928432ab7e15829aa7 100644 (file)
@@ -201,7 +201,7 @@ export default defineComponent({
 
        methods: {
                onToggleDeadline(checked: boolean) {
-                       this.$emit('update:expirationDate', checked ? new Date() : null)
+                       this.$emit('update:expirationDate', checked ? (this.maxDate || this.minDate) : null)
                },
 
                async onTogglePassword(checked: boolean) {
index e626cb317514f90da03092edd2dc03a2ba56363a..dae1739d308be1fd625bd89eb1dc7afa6de5f294 100644 (file)
@@ -17,6 +17,7 @@
                        :readonly="true"
                        :show-trailing-button="true"
                        :trailing-button-label="t('files_sharing', 'Copy to clipboard')"
+                       data-cy-file-request-dialog-fieldset="link"
                        @click="copyShareLink"
                        @trailing-button-click="copyShareLink">
                        <template #trailing-button-icon>
@@ -30,6 +31,7 @@
                        <NcTextField :value.sync="email"
                                :label="t('files_sharing', 'Send link via email')"
                                :placeholder="t('files_sharing', 'Enter an email address or paste a list')"
+                               data-cy-file-request-dialog-fieldset="email"
                                type="email"
                                @keypress.enter.stop="addNewEmail"
                                @paste.stop.prevent="onPasteEmails"
index 79f9eae3098cd50a48bb549275612c712b32c045..7d859e1268ad59f81a7a4507d8adbde3bba0dd09 100644 (file)
@@ -14,8 +14,10 @@ const NewFileRequestDialogVue = defineAsyncComponent(() => import('../components
 
 const sharingConfig = new Config()
 
+export const EntryId = 'file-request'
+
 export const entry = {
-       id: 'file-request',
+       id: EntryId,
        displayName: t('files_sharing', 'Create file request'),
        iconSvgInline: FileUploadSvg,
        order: 30,