aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2023-10-16 17:35:35 +0100
committerfenn-cs <fenn25.fn@gmail.com>2023-10-22 15:47:45 +0100
commit46308e96f36486dd9dd55a41c1979d7f6cafacfe (patch)
tree07012b6c000465769d7a34cb188f11c9be0fc838 /apps/files_sharing/src
parent92417cd59460f11da54aeabd4ebd8ffd5aa8f69b (diff)
downloadnextcloud-server-46308e96f36486dd9dd55a41c1979d7f6cafacfe.tar.gz
nextcloud-server-46308e96f36486dd9dd55a41c1979d7f6cafacfe.zip
Fix has expiration date logic
Current expiration date errorneously assumes that `defaultExpirationDate` applies to all kinds of shares. But it only really applies to public shares despite its name. This commit, fixes that by paring expiration dates with the correct share types during new share initialization and simplifying the `hasExpirationDate` (check) property. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/views/SharingDetailsTab.vue27
1 files changed, 12 insertions, 15 deletions
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue
index de52dda618b..c5ef4e96739 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -385,19 +385,7 @@ export default {
*/
hasExpirationDate: {
get() {
- const isDefaultExpireDateEnabled = this.config.isDefaultExpireDateEnabled
- const hasExistingExpirationDate = !!this.share.expireDate || isDefaultExpireDateEnabled
- const isDefaultInternalExpireDateEnabled = this.config.isDefaultInternalExpireDateEnabled
- const isDefaultRemoteExpireDateEnabled = this.config.isDefaultRemoteExpireDateEnabled
- if (this.isPublicShare) {
- return hasExistingExpirationDate
- }
-
- if (this.isRemoteShare) {
- return hasExistingExpirationDate || isDefaultRemoteExpireDateEnabled
- }
-
- return hasExistingExpirationDate || isDefaultInternalExpireDateEnabled
+ return this.isValidShareAttribute(this.share.expireDate)
},
set(enabled) {
this.share.expireDate = enabled
@@ -715,10 +703,19 @@ export default {
this.share.newPassword = await GeneratePassword()
this.advancedSectionAccordionExpanded = true
}
- if (this.hasExpirationDate) {
- this.share.expireDate = this.defaultExpiryDate
+ /* Set default expiration dates if configured */
+ if (this.isPublicShare && this.config.isDefaultExpireDateEnabled) {
+ this.share.expireDate = this.config.defaultExpirationDate.toDateString()
+ } else if (this.isRemoteShare && this.config.isDefaultRemoteExpireDateEnabled) {
+ this.share.expireDate = this.config.defaultRemoteExpirationDateString.toDateString()
+ } else if (this.config.isDefaultInternalExpireDateEnabled) {
+ this.share.expireDate = this.config.defaultInternalExpirationDate.toDateString()
+ }
+
+ if (this.isValidShareAttribute(this.share.expireDate)) {
this.advancedSectionAccordionExpanded = true
}
+
return
}