Skip to content

Commit fee38e6

Browse files
committed
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>
1 parent 830b2c5 commit fee38e6

7 files changed

Lines changed: 21 additions & 17 deletions

File tree

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,10 @@
113113
</NcCheckboxRadioSwitch>
114114
<NcDateTimePickerNative v-if="hasExpirationDate"
115115
id="share-date-picker"
116-
:value="new Date(share.expireDate)"
116+
:value="new Date(share.expireDate ?? dateTomorrow)"
117117
:min="dateTomorrow"
118-
:max="dateMaxEnforced"
118+
:max="maxExpirationDateEnforced"
119119
:hide-label="true"
120-
:disabled="isExpiryDateEnforced"
121120
:placeholder="t('files_sharing', 'Expiration date')"
122121
type="date"
123122
@input="onExpirationChange" />
@@ -418,11 +417,16 @@ export default {
418417
isFolder() {
419418
return this.fileInfo.type === 'dir'
420419
},
421-
dateMaxEnforced() {
422-
if (!this.isRemoteShare && this.config.isDefaultInternalExpireDateEnforced) {
423-
return new Date(new Date().setDate(new Date().getDate() + 1 + this.config.defaultInternalExpireDate))
424-
} else if (this.config.isDefaultRemoteExpireDateEnforced) {
425-
return new Date(new Date().setDate(new Date().getDate() + 1 + this.config.defaultRemoteExpireDate))
420+
maxExpirationDateEnforced() {
421+
if (this.isPublicShare) {
422+
return this.config.defaultExpirationDate
423+
}
424+
if (this.isRemoteShare) {
425+
return this.config.defaultRemoteExpirationDateString
426+
}
427+
// If it get's here then it must be an internal share
428+
if (this.isExpiryDateEnforced) {
429+
return this.config.defaultInternalExpirationDate
426430
}
427431
return null
428432
},

dist/core-common.js

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

dist/core-common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-files_sharing_tab.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-files_sharing_tab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)