aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-07-16 18:40:20 +0200
committerskjnldsv <skjnldsv@protonmail.com>2024-07-18 19:47:11 +0200
commit55d41941bcc06bfe80ef3f11ef9d97a79b1873c3 (patch)
tree792aaf9151b740b3d37a2b828afb7c84c2d04cbc
parenteb2cda13c839f3e4fcb31fdb176e248ac2c73a38 (diff)
downloadnextcloud-server-55d41941bcc06bfe80ef3f11ef9d97a79b1873c3.tar.gz
nextcloud-server-55d41941bcc06bfe80ef3f11ef9d97a79b1873c3.zip
fix(files_sharing): improve file request email handling
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog.vue2
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue4
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue22
3 files changed, 19 insertions, 9 deletions
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog.vue b/apps/files_sharing/src/components/NewFileRequestDialog.vue
index 1b29457a677..398fd976f02 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog.vue
@@ -212,7 +212,7 @@ export default defineComponent({
if (this.emails.length === 0) {
return t('files_sharing', 'Close')
}
- return n('files_sharing', 'Close and send email', 'Close and send {count} emails', this.emails.length, { count: this.emails.length })
+ return n('files_sharing', 'Send email and close', 'Send {count} emails and close', this.emails.length, { count: this.emails.length })
},
},
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
index e88496c8416..c1b7951e1b5 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
@@ -13,7 +13,7 @@
<!-- Expiration date -->
<fieldset class="file-request-dialog__expiration" data-cy-file-request-dialog-fieldset="expiration">
<NcNoteCard v-if="defaultExpireDateEnforced" type="info">
- {{ t('files_sharing', 'Your administrator has enforced a default expiration date with a maximum {days} days.', { days: defaultExpireDate }) }}
+ {{ t('files_sharing', 'Your administrator has enforced a default expiration date with a maximum of {days} days.', { days: defaultExpireDate }) }}
</NcNoteCard>
<!-- Enable expiration -->
@@ -22,7 +22,7 @@
:checked="defaultExpireDateEnforced || expirationDate !== null"
:disabled="disabled || defaultExpireDateEnforced"
@update:checked="onToggleDeadline">
- {{ t('files_sharing', 'Set a submission expirationDate') }}
+ {{ t('files_sharing', 'Set a submission expiration date') }}
</NcCheckboxRadioSwitch>
<!-- Date picker -->
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue
index 7f4642e1564..0e18ef90860 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue
@@ -45,9 +45,10 @@
<template #icon>
<NcAvatar :disable-menu="true"
:disable-tooltip="true"
- :is-guest="true"
- :size="24"
- :user="mail" />
+ :display-name="mail"
+ :is-no-user="true"
+ :show-user-status="false"
+ :size="24" />
</template>
</NcChip>
</div>
@@ -147,7 +148,15 @@ export default defineComponent({
},
addNewEmail(e: KeyboardEvent) {
+ if (this.email.trim() === '') {
+ return
+ }
+
if (e.target instanceof HTMLInputElement) {
+ // Reset the custom validity
+ e.target.setCustomValidity('')
+
+ // Check if the field is valid
if (e.target.checkValidity() === false) {
e.target.reportValidity()
return
@@ -160,6 +169,7 @@ export default defineComponent({
return
}
+ // Check if the email is valid
if (!this.isValidEmail(this.email.trim())) {
e.target.setCustomValidity(t('files_sharing', 'Invalid email address'))
e.target.reportValidity()
@@ -203,9 +213,9 @@ export default defineComponent({
this.email = ''
},
- isValidEmail(email) {
- const regExpEmail = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
- return regExpEmail.test(email)
+ // No need to have a fancy regex, just check for an @
+ isValidEmail(email: string): boolean {
+ return email.includes('@')
},
},
})