summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2023-10-15 21:41:07 +0100
committerfenn-cs <fenn25.fn@gmail.com>2023-10-16 07:03:53 +0100
commit9757e680e2f643fe19432255c4142e96fbc88df5 (patch)
tree390b51cbaf59aab16b1ea35daa57255ba4377bd1 /apps/files_sharing
parent356c2219bc935526ee0f304e28695552e4f0827e (diff)
downloadnextcloud-server-9757e680e2f643fe19432255c4142e96fbc88df5.tar.gz
nextcloud-server-9757e680e2f643fe19432255c4142e96fbc88df5.zip
Allow share expiry dates lower than enforced limits
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>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/src/views/SharingDetailsTab.vue20
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue
index 17ede38af6a..6fc1c6d89ea 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -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" />
@@ -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
},