diff options
Diffstat (limited to 'apps/files_sharing/src/services/ConfigService.js')
-rw-r--r-- | apps/files_sharing/src/services/ConfigService.js | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/apps/files_sharing/src/services/ConfigService.js b/apps/files_sharing/src/services/ConfigService.js index bfef48a8ade..e3cd6ad8d46 100644 --- a/apps/files_sharing/src/services/ConfigService.js +++ b/apps/files_sharing/src/services/ConfigService.js @@ -60,57 +60,45 @@ export default class Config { } /** - * Get the default link share expiration date as string + * Get the default link share expiration date * - * @return {string} + * @return {Date|null} * @readonly * @memberof Config */ - get defaultExpirationDateString() { - let expireDateString = '' + get defaultExpirationDate() { if (this.isDefaultExpireDateEnabled) { - const date = window.moment.utc() - const expireAfterDays = this.defaultExpireDate - date.add(expireAfterDays, 'days') - expireDateString = date.format('YYYY-MM-DD') + return new Date(new Date().setDate(new Date().getDate() + this.defaultExpireDate)) } - return expireDateString + return null } /** - * Get the default internal expiration date as string + * Get the default internal expiration date * - * @return {string} + * @return {Date|null} * @readonly * @memberof Config */ - get defaultInternalExpirationDateString() { - let expireDateString = '' + get defaultInternalExpirationDate() { if (this.isDefaultInternalExpireDateEnabled) { - const date = window.moment.utc() - const expireAfterDays = this.defaultInternalExpireDate - date.add(expireAfterDays, 'days') - expireDateString = date.format('YYYY-MM-DD') + return new Date(new Date().setDate(new Date().getDate() + this.defaultInternalExpireDate)) } - return expireDateString + return null } /** - * Get the default remote expiration date as string + * Get the default remote expiration date * - * @return {string} + * @return {Date|null} * @readonly * @memberof Config */ get defaultRemoteExpirationDateString() { - let expireDateString = '' if (this.isDefaultRemoteExpireDateEnabled) { - const date = window.moment.utc() - const expireAfterDays = this.defaultRemoteExpireDate - date.add(expireAfterDays, 'days') - expireDateString = date.format('YYYY-MM-DD') + return new Date(new Date().setDate(new Date().getDate() + this.defaultRemoteExpireDate)) } - return expireDateString + return null } /** @@ -191,6 +179,17 @@ export default class Config { } /** + * Is there a default expiration date for new remote shares ? + * + * @return {boolean} + * @readonly + * @memberof Config + */ + get isDefaultRemoteExpireDateEnabled() { + return OC.appConfig.core.defaultRemoteExpireDateEnabled === true + } + + /** * Are users on this server allowed to send shares to other servers ? * * @return {boolean} |