aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/src/components')
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue30
-rw-r--r--apps/files_sharing/src/components/SharingEntry.vue4
-rw-r--r--apps/files_sharing/src/components/SharingInput.vue40
3 files changed, 50 insertions, 24 deletions
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
index 4c14b21e1d5..7e6d56e8794 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
@@ -14,9 +14,9 @@
<fieldset class="file-request-dialog__expiration" data-cy-file-request-dialog-fieldset="expiration">
<!-- Enable expiration -->
<legend>{{ t('files_sharing', 'When should the request expire?') }}</legend>
- <NcCheckboxRadioSwitch v-show="!defaultExpireDateEnforced"
- :checked="defaultExpireDateEnforced || expirationDate !== null"
- :disabled="disabled || defaultExpireDateEnforced"
+ <NcCheckboxRadioSwitch v-show="!isExpirationDateEnforced"
+ :checked="isExpirationDateEnforced || expirationDate !== null"
+ :disabled="disabled || isExpirationDateEnforced"
@update:checked="onToggleDeadline">
{{ t('files_sharing', 'Set a submission expiration date') }}
</NcCheckboxRadioSwitch>
@@ -46,9 +46,9 @@
<fieldset class="file-request-dialog__password" data-cy-file-request-dialog-fieldset="password">
<!-- Enable password -->
<legend>{{ t('files_sharing', 'What password should be used for the request?') }}</legend>
- <NcCheckboxRadioSwitch v-show="!enforcePasswordForPublicLink"
- :checked="enforcePasswordForPublicLink || password !== null"
- :disabled="disabled || enforcePasswordForPublicLink"
+ <NcCheckboxRadioSwitch v-show="!isPasswordEnforced"
+ :checked="isPasswordEnforced || password !== null"
+ :disabled="disabled || isPasswordEnforced"
@update:checked="onTogglePassword">
{{ t('files_sharing', 'Set a password') }}
</NcCheckboxRadioSwitch>
@@ -59,7 +59,7 @@
:disabled="disabled"
:label="t('files_sharing', 'Password')"
:placeholder="t('files_sharing', 'Enter a valid password')"
- :required="false"
+ :required="enforcePasswordForPublicLink"
:value="password"
name="password"
@update:value="$emit('update:password', $event)" />
@@ -180,6 +180,18 @@ export default defineComponent({
return ''
},
+
+ isExpirationDateEnforced(): boolean {
+ // Both fields needs to be enabled in the settings
+ return this.defaultExpireDateEnabled
+ && this.defaultExpireDateEnforced
+ },
+
+ isPasswordEnforced(): boolean {
+ // Both fields needs to be enabled in the settings
+ return this.enableLinkPasswordByDefault
+ && this.enforcePasswordForPublicLink
+ },
},
mounted() {
@@ -189,12 +201,12 @@ export default defineComponent({
}
// If enforced, we cannot set a date before the default expiration days (see admin settings)
- if (this.defaultExpireDateEnforced) {
+ if (this.isExpirationDateEnforced) {
this.maxDate = sharingConfig.defaultExpirationDate
}
// If enabled by default, we generate a valid password
- if (this.enableLinkPasswordByDefault) {
+ if (this.isPasswordEnforced) {
this.generatePassword()
}
},
diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue
index 4ff5fae364b..1fbe740cb11 100644
--- a/apps/files_sharing/src/components/SharingEntry.vue
+++ b/apps/files_sharing/src/components/SharingEntry.vue
@@ -77,9 +77,9 @@ export default {
title += ` (${t('files_sharing', 'group')})`
} else if (this.share.type === ShareType.Room) {
title += ` (${t('files_sharing', 'conversation')})`
- } else if (this.share.type === ShareType.Remote) {
+ } else if (this.share.type === ShareType.Remote && !this.share.isTrustedServer) {
title += ` (${t('files_sharing', 'remote')})`
- } else if (this.share.type === ShareType.RemoteGroup) {
+ } else if (this.share.type === ShareType.RemoteGroup && !this.share.isTrustedServer) {
title += ` (${t('files_sharing', 'remote group')})`
} else if (this.share.type === ShareType.Guest) {
title += ` (${t('files_sharing', 'guest')})`
diff --git a/apps/files_sharing/src/components/SharingInput.vue b/apps/files_sharing/src/components/SharingInput.vue
index b886ba95a17..f50dc96fc08 100644
--- a/apps/files_sharing/src/components/SharingInput.vue
+++ b/apps/files_sharing/src/components/SharingInput.vue
@@ -192,14 +192,27 @@ export default {
lookup = true
}
- let shareType = []
-
const remoteTypes = [ShareType.Remote, ShareType.RemoteGroup]
-
- if (this.isExternal && !this.config.showFederatedSharesAsInternal) {
- shareType.push(...remoteTypes)
+ const shareType = []
+
+ const showFederatedAsInternal
+ = this.config.showFederatedSharesAsInternal
+ || this.config.showFederatedSharesToTrustedServersAsInternal
+
+ const shouldAddRemoteTypes
+ // For internal users, add remote types if config says to show them as internal
+ = (!this.isExternal && showFederatedAsInternal)
+ // For external users, add them if config *doesn't* say to show them as internal
+ || (this.isExternal && !showFederatedAsInternal)
+ // Edge case: federated-to-trusted is a separate "add" trigger for external users
+ || (this.isExternal && this.config.showFederatedSharesToTrustedServersAsInternal)
+
+ if (this.isExternal) {
+ if (getCapabilities().files_sharing.public.enabled === true) {
+ shareType.push(ShareType.Email)
+ }
} else {
- shareType = shareType.concat([
+ shareType.push(
ShareType.User,
ShareType.Group,
ShareType.Team,
@@ -207,15 +220,11 @@ export default {
ShareType.Guest,
ShareType.Deck,
ShareType.ScienceMesh,
- ])
-
- if (this.config.showFederatedSharesAsInternal) {
- shareType.push(...remoteTypes)
- }
+ )
}
- if (getCapabilities().files_sharing.public.enabled === true && this.isExternal) {
- shareType.push(ShareType.Email)
+ if (shouldAddRemoteTypes) {
+ shareType.push(...remoteTypes)
}
let request = null
@@ -366,6 +375,11 @@ export default {
// filter out existing mail shares
if (share.value.shareType === ShareType.Email) {
+ // When sharing internally, we don't want to suggest email addresses
+ // that the user previously created shares to
+ if (!this.isExternal) {
+ return arr
+ }
const emails = this.linkShares.map(elem => elem.shareWith)
if (emails.indexOf(share.value.shareWith.trim()) !== -1) {
return arr