From 31172a0cd917716c6022edbfa580e19a6da50db8 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Fri, 1 May 2020 14:42:01 +0200 Subject: Process shares only once, better debug and expiration date code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) Signed-off-by: npmbuildbot[bot] --- .../src/components/SharingEntryLink.vue | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'apps/files_sharing/src/components/SharingEntryLink.vue') diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue index 5e15db16685..f8b8137cd29 100644 --- a/apps/files_sharing/src/components/SharingEntryLink.vue +++ b/apps/files_sharing/src/components/SharingEntryLink.vue @@ -398,15 +398,19 @@ export default { * @returns {boolean} */ hasExpirationDate: { - get: function() { - return this.config.isDefaultExpireDateEnforced || !!this.share.expireDate + get() { + return this.config.isDefaultExpireDateEnforced + || !!this.share.expireDate }, - set: function(enabled) { - this.share.expireDate = enabled - ? this.config.defaultExpirationDateString !== '' - ? this.config.defaultExpirationDateString - : moment().format('YYYY-MM-DD') + set(enabled) { + let dateString = moment(this.config.defaultExpirationDateString) + if (!dateString.isValid()) { + dateString = moment() + } + this.share.state.expiration = enabled + ? dateString.format('YYYY-MM-DD') : '' + console.debug('Expiration date status', enabled, this.share.expireDate) }, }, @@ -420,11 +424,11 @@ export default { * @returns {boolean} */ isPasswordProtected: { - get: function() { + get() { return this.config.enforcePasswordForPublicLink || !!this.share.password }, - set: async function(enabled) { + async set(enabled) { // TODO: directly save after generation to make sure the share is always protected Vue.set(this.share, 'password', enabled ? await this.generatePassword() : '') Vue.set(this.share, 'newPassword', this.share.password) -- cgit v1.2.3