mirror of
https://github.com/nextcloud/server.git
synced 2026-05-14 09:29:52 -04:00
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>
This commit is contained in:
parent
77b047cc62
commit
a5a9564069
3 changed files with 15 additions and 18 deletions
|
|
@ -373,19 +373,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
|
||||
|
|
@ -703,10 +691,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
|
||||
}
|
||||
|
||||
|
|
|
|||
4
dist/files_sharing-files_sharing_tab.js
vendored
4
dist/files_sharing-files_sharing_tab.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_sharing-files_sharing_tab.js.map
vendored
2
dist/files_sharing-files_sharing_tab.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue