Skip to content

Commit

Permalink
Fix has expiration date logic
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
nfebe committed Oct 16, 2023
1 parent 9ac70a2 commit 2eda6db
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
31 changes: 16 additions & 15 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -715,10 +703,23 @@ export default {
this.share.newPassword = await GeneratePassword()
this.advancedSectionAccordionExpanded = true
}
if (this.hasExpirationDate) {
this.share.expireDate = this.defaultExpiryDate
/* Set default expiration dates if set */
if (this.isPublicShare && this.config.isDefaultExpireDateEnabled) {
this.share.expireDate = this.config.defaultExpirationDate.toDateString()
}
if (this.isRemoteShare && this.config.isDefaultRemoteExpireDateEnabled) {
this.share.expireDate = this.config.defaultRemoteExpirationDateString.toDateString()
}
if (this.config.isDefaultInternalExpireDateEnabled) {
this.share.expireDate = this.config.defaultInternalExpirationDate.toDateString()
}
if (this.isValidShareAttribute(this.share.expireDate)) {
this.advancedSectionAccordionExpanded = true
}
return
}
Expand Down
3 changes: 0 additions & 3 deletions dist/8972-8972.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/8972-8972.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions dist/9941-9941.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/9941-9941.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

0 comments on commit 2eda6db

Please sign in to comment.