aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorF. E Noel Nfebe <fenn25.fn@gmail.com>2024-11-09 14:24:02 +0100
committerGitHub <noreply@github.com>2024-11-09 14:24:02 +0100
commit4692f8d11a0acd7886d2fa6da3983ab9a1a45b15 (patch)
treeb39b4280dbaed1172d81c27ecc0e129e3e6212ef /apps
parent832d479c839b913d914178a646525cf28a0d1061 (diff)
parent7e3d7b3b29e87574edf8d573dd7ec7c407e85181 (diff)
downloadnextcloud-server-4692f8d11a0acd7886d2fa6da3983ab9a1a45b15.tar.gz
nextcloud-server-4692f8d11a0acd7886d2fa6da3983ab9a1a45b15.zip
Merge pull request #49148 from nextcloud/backport/49115/stable28
[stable28] fix(SharingEntryLink): Show default password before create if any
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/src/components/SharingEntryLink.vue48
1 files changed, 41 insertions, 7 deletions
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index 8c6235a78ee..294f48b5350 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -50,7 +50,7 @@
</div>
<!-- pending actions -->
- <NcActions v-if="!pending && (pendingPassword || pendingEnforcedPassword || pendingExpirationDate)"
+ <NcActions v-if="!pending && pendingDataIsMissing"
class="sharing-entry__actions"
:aria-label="actionsTooltip"
menu-align="right"
@@ -88,6 +88,14 @@
{{ t('files_sharing', 'Enter a password') }}
</NcActionInput>
+ <NcActionCheckbox v-if="hasDefaultExpirationDate"
+ :checked.sync="defaultExpirationDateEnabled"
+ :disabled="pendingEnforcedExpirationDate || saving"
+ class="share-link-expiration-date-checkbox"
+ @change="onDefaultExpirationDateEnabledChange">
+ {{ config.enforcePasswordForPublicLink ? t('files_sharing', 'Enable link expiration (enforced)') : t('files_sharing', 'Enable link expiration') }}
+ </NcActionCheckbox>
+
<!-- expiration date -->
<NcActionText v-if="pendingExpirationDate" icon="icon-calendar-dark">
{{ t('files_sharing', 'Expiration date (enforced)') }}
@@ -242,6 +250,7 @@ export default {
shareCreationComplete: false,
copySuccess: true,
copied: false,
+ defaultExpirationDateEnabled: false,
// Are we waiting for password/expiration date
pending: false,
@@ -402,14 +411,28 @@ export default {
*
* @return {boolean}
*/
+ pendingDataIsMissing() {
+ return this.pendingPassword || this.pendingEnforcedPassword || this.pendingEnforcedExpirationDate
+ },
pendingPassword() {
- return this.config.enableLinkPasswordByDefault && this.share && !this.share.id
+ return this.config.enableLinkPasswordByDefault && this.isPendingShare
},
pendingEnforcedPassword() {
- return this.config.enforcePasswordForPublicLink && this.share && !this.share.id
+ return this.config.enforcePasswordForPublicLink && this.isPendingShare
},
- pendingExpirationDate() {
- return this.config.isDefaultExpireDateEnforced && this.share && !this.share.id
+ pendingEnforcedExpirationDate() {
+ return this.config.isDefaultExpireDateEnforced && this.isPendingShare
+ },
+ hasDefaultExpirationDate() {
+ return (this.config.defaultExpirationDate instanceof Date || !isNaN(new Date(this.config.defaultExpirationDate).getTime())) && this.isPendingShare
+ },
+
+ isPendingShare() {
+ return !!(this.share && !this.share.id)
+ },
+
+ shareRequiresReview() {
+ return this.defaultExpirationDateEnabled || this.config.enableLinkPasswordByDefault
},
sharePolicyHasRequiredProperties() {
@@ -508,6 +531,12 @@ export default {
return this.fileInfo.shareAttributes.some(hasDisabledDownload)
},
},
+ mounted() {
+ if (this.share) {
+ this.defaultExpirationDateEnabled = this.config.defaultExpirationDate instanceof Date
+ this.share.expireDate = this.defaultExpirationDateEnabled ? this.formatDateToString(this.config.defaultExpirationDate) : ''
+ }
+ },
methods: {
/**
@@ -530,8 +559,10 @@ export default {
}
this.logger.debug('Missing required properties?', this.requiredPropertiesMissing)
- // do not push yet if we need a password or an expiration date: show pending menu
- if (this.sharePolicyHasRequiredProperties && this.requiredPropertiesMissing) {
+ // Do not push yet if we need a password or an expiration date: show pending menu
+ // A share would require a review for example is default expiration date is set but not enforced, this allows
+ // the user to review the share and remove the expiration date if they don't want it
+ if ((this.sharePolicyHasRequiredProperties && this.requiredPropertiesMissing) || this.shareRequiresReview) {
this.pending = true
this.shareCreationComplete = false
@@ -765,6 +796,9 @@ export default {
this.onPasswordSubmit()
this.onNoteSubmit()
},
+ onDefaultExpirationDateEnabledChange(enabled) {
+ this.share.expireDate = enabled ? this.formatDateToString(this.config.defaultExpirationDate) : ''
+ },
/**
* Cancel the share creation