Skip to content

Commit

Permalink
Allow share expiry dates lower than enforced limits
Browse files Browse the repository at this point in the history
Previously, users could change the share expiry date up
to the enforced maximum.

The new share flow imposed the enforced share expiry
date maximum literally and did not allow even dates
lower than the maximum enforced.

That does not make much sense, if the enforced expiry date is 30
days from creation date, then it's logical to allow users set the
date to anything less than 30 days from the creation date.

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
  • Loading branch information
Fenn-CS committed Oct 15, 2023
1 parent 7e2c512 commit b24b3aa
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Expand Up @@ -119,11 +119,10 @@
</NcCheckboxRadioSwitch>
<NcDateTimePickerNative v-if="hasExpirationDate"
id="share-date-picker"
:value="new Date(share.expireDate)"
:value="new Date(share.expireDate ?? dateTomorrow)"
:min="dateTomorrow"
:max="dateMaxEnforced"
:max="maxExpirationDateEnforced"
:hide-label="true"
:disabled="isExpiryDateEnforced"
:placeholder="t('files_sharing', 'Expiration date')"
type="date"
@input="onExpirationChange" />
Expand Down Expand Up @@ -430,11 +429,16 @@ export default {
isFolder() {
return this.fileInfo.type === 'dir'
},
dateMaxEnforced() {
if (!this.isRemoteShare && this.config.isDefaultInternalExpireDateEnforced) {
return new Date(new Date().setDate(new Date().getDate() + 1 + this.config.defaultInternalExpireDate))
} else if (this.config.isDefaultRemoteExpireDateEnforced) {
return new Date(new Date().setDate(new Date().getDate() + 1 + this.config.defaultRemoteExpireDate))
maxExpirationDateEnforced() {
if (this.isPublicShare) {
return this.config.defaultExpirationDate
}
if (this.isRemoteShare) {
return this.config.defaultRemoteExpirationDateString
}
// If it get's here then it must be an internal share
if (this.isExpiryDateEnforced) {
return this.config.defaultInternalExpirationDate
}
return null
},
Expand Down

0 comments on commit b24b3aa

Please sign in to comment.