summaryrefslogtreecommitdiffstats
path: root/apps
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-28 09:53:41 +0100
commit281e9ac559802a8dbc7bfc9796a3e860331b57bf (patch)
tree89a102f125d80bbccaac4980449fd261d68c6c5a /apps
parent4f222b9fbaab04fe92f3f0ae6c8da05c824b4050 (diff)
downloadnextcloud-server-281e9ac559802a8dbc7bfc9796a3e860331b57bf.tar.gz
nextcloud-server-281e9ac559802a8dbc7bfc9796a3e860331b57bf.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')
-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 dbe3824be8a..657daa2dfb8 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -113,11 +113,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" />
@@ -418,11 +417,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
},