aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/components/NewFileRequestDialog.vue
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-07-16 17:59:03 +0200
committerskjnldsv <skjnldsv@protonmail.com>2024-07-18 19:47:11 +0200
commit365b647b60d9380bbbd88fb00984b294db9062c2 (patch)
treed2550ba3582505fe614377c8748af001bdb302bb /apps/files_sharing/src/components/NewFileRequestDialog.vue
parenta5fdd1c64a1f2430941c6ba888956eef04c53a7d (diff)
downloadnextcloud-server-365b647b60d9380bbbd88fb00984b294db9062c2.tar.gz
nextcloud-server-365b647b60d9380bbbd88fb00984b294db9062c2.zip
fix(files_sharing): file request conditions with link/email global settings
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/src/components/NewFileRequestDialog.vue')
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog.vue24
1 files changed, 18 insertions, 6 deletions
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog.vue b/apps/files_sharing/src/components/NewFileRequestDialog.vue
index 35cd4395290..2e15babeae5 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog.vue
@@ -95,7 +95,7 @@
@click="onFinish">
<template #icon>
<NcLoadingIcon v-if="loading" />
- <IconCheck v-else :size="20" />
+ <IconCheck v-else-if="success" :size="20" />
</template>
{{ finishButtonLabel }}
</NcButton>
@@ -182,6 +182,7 @@ export default defineComponent({
return {
currentStep: STEP.FIRST,
loading: false,
+ success: false,
destination: this.context.path || '/',
label: '',
@@ -244,10 +245,19 @@ export default defineComponent({
return
}
- await this.setShareEmails()
- await this.sendEmails()
- showSuccess(this.t('files_sharing', 'File request created and emails sent'))
- this.$emit('close')
+ if (sharingConfig.isMailShareAllowed && this.emails.length > 0) {
+ await this.setShareEmails()
+ await this.sendEmails()
+ showSuccess(this.n('files_sharing', 'File request created and email sent', 'File request created and {count} emails sent', this.emails.length, { count: this.emails.length }))
+ } else {
+ showSuccess(this.t('files_sharing', 'File request created'))
+ }
+
+ // Show success then close
+ this.success = true
+ setTimeout(() => {
+ this.$emit('close')
+ }, 3000)
},
async createShare() {
@@ -258,7 +268,9 @@ export default defineComponent({
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares')
try {
const request = await axios.post<OCSResponse>(shareUrl, {
- shareType: ShareType.Email,
+ // Always create a file request, but without mail share
+ // permissions, only a share link will be created.
+ shareType: sharingConfig.isMailShareAllowed ? ShareType.Email : ShareType.Link,
permissions: Permission.CREATE,
label: this.label,