aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-07-19 17:33:14 +0200
committerGitHub <noreply@github.com>2024-07-19 17:33:14 +0200
commitbc531be406dd93da1734784862f1b2e705132e26 (patch)
tree345a9aaa6dd799e091ff06f8540415d07672709d /apps/files_sharing
parent1d77a3883f285ad676ca71946a2c98ac79094b75 (diff)
parent29bec6ea22a38b74597bf643a3e027910e0b5ef1 (diff)
downloadnextcloud-server-bc531be406dd93da1734784862f1b2e705132e26.tar.gz
nextcloud-server-bc531be406dd93da1734784862f1b2e705132e26.zip
Merge pull request #46631 from nextcloud/feat/file-request-cypress
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog.vue22
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue2
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue2
-rw-r--r--apps/files_sharing/src/new/newFileRequest.ts4
-rw-r--r--apps/files_sharing/src/views/PublicAuthPrompt.vue9
5 files changed, 21 insertions, 18 deletions
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog.vue b/apps/files_sharing/src/components/NewFileRequestDialog.vue
index 6b0bb5a1fc2..bdcaf1d90bf 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog.vue
@@ -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: '',
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
index 0eb89388122..091679ae5c4 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
@@ -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) {
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue
index e626cb31751..dae1739d308 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue
@@ -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"
diff --git a/apps/files_sharing/src/new/newFileRequest.ts b/apps/files_sharing/src/new/newFileRequest.ts
index 79f9eae3098..7d859e1268a 100644
--- a/apps/files_sharing/src/new/newFileRequest.ts
+++ b/apps/files_sharing/src/new/newFileRequest.ts
@@ -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,
diff --git a/apps/files_sharing/src/views/PublicAuthPrompt.vue b/apps/files_sharing/src/views/PublicAuthPrompt.vue
index a929afffefb..2e61bec7434 100644
--- a/apps/files_sharing/src/views/PublicAuthPrompt.vue
+++ b/apps/files_sharing/src/views/PublicAuthPrompt.vue
@@ -5,6 +5,7 @@
<template>
<NcDialog class="public-auth-prompt"
+ data-cy-public-auth-prompt-dialog
dialog-classes="public-auth-prompt__dialog"
:can-close="false"
:name="dialogName">
@@ -26,16 +27,18 @@
@submit.prevent.stop="">
<NcTextField ref="input"
class="public-auth-prompt__input"
+ data-cy-public-auth-prompt-dialog-name
:label="t('files_sharing', 'Enter your name')"
- name="name"
- :required="true"
:minlength="2"
- :value.sync="name" />
+ :required="true"
+ :value.sync="name"
+ name="name" />
</form>
<!-- Submit -->
<template #actions>
<NcButton ref="submit"
+ data-cy-public-auth-prompt-dialog-submit
:disabled="name.trim() === ''"
@click="onSubmit">
{{ t('files_sharing', 'Submit name') }}