aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-04-15 12:06:54 -0100
committerGitHub <noreply@github.com>2021-04-15 12:06:54 -0100
commit1c35b3801e49eb9011040a23e64d787172fa562e (patch)
tree9b608272439503e0015ece40ae4b77013eabc81f /apps/files_sharing/src
parent8ef920fdf90bc54d6f17134ebd80a71db2f9d8ea (diff)
parentaf61486aea90cfc1a82301ce624dffb59ed01e07 (diff)
downloadnextcloud-server-1c35b3801e49eb9011040a23e64d787172fa562e.tar.gz
nextcloud-server-1c35b3801e49eb9011040a23e64d787172fa562e.zip
Merge pull request #25320 from nextcloud/bugfix/noid/save-fed-share-expiration
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/components/SharingEntry.vue23
-rw-r--r--apps/files_sharing/src/services/ConfigService.js40
2 files changed, 51 insertions, 12 deletions
diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue
index d31c7ef6e3f..e07654a19c1 100644
--- a/apps/files_sharing/src/components/SharingEntry.vue
+++ b/apps/files_sharing/src/components/SharingEntry.vue
@@ -84,16 +84,14 @@
</ActionCheckbox>
<!-- expiration date -->
- <ActionCheckbox
- v-if="canHaveExpirationDate"
- :checked.sync="hasExpirationDate"
+ <ActionCheckbox :checked.sync="hasExpirationDate"
:disabled="config.isDefaultInternalExpireDateEnforced || saving"
@uncheck="onExpirationDisable">
{{ config.isDefaultInternalExpireDateEnforced
? t('files_sharing', 'Expiration date enforced')
: t('files_sharing', 'Set expiration date') }}
</ActionCheckbox>
- <ActionInput v-if="canHaveExpirationDate && hasExpirationDate"
+ <ActionInput v-if="hasExpirationDate"
ref="expireDate"
v-tooltip.auto="{
content: errors.expireDate,
@@ -224,14 +222,10 @@ export default {
},
canHaveNote() {
- return !this.isRemoteShare
- },
-
- canHaveExpirationDate() {
- return !this.isRemoteShare
+ return !this.isRemote
},
- isRemoteShare() {
+ isRemote() {
return this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE
|| this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP
},
@@ -358,8 +352,13 @@ export default {
},
dateMaxEnforced() {
- return this.config.isDefaultInternalExpireDateEnforced
- && moment().add(1 + this.config.defaultInternalExpireDate, 'days')
+ if (!this.isRemote) {
+ return this.config.isDefaultInternalExpireDateEnforced
+ && moment().add(1 + this.config.defaultInternalExpireDate, 'days')
+ } else {
+ return this.config.isDefaultRemoteExpireDateEnforced
+ && moment().add(1 + this.config.defaultRemoteExpireDate, 'days')
+ }
},
/**
diff --git a/apps/files_sharing/src/services/ConfigService.js b/apps/files_sharing/src/services/ConfigService.js
index 84ee5ee0a69..4c8326b1570 100644
--- a/apps/files_sharing/src/services/ConfigService.js
+++ b/apps/files_sharing/src/services/ConfigService.js
@@ -96,6 +96,24 @@ export default class Config {
}
/**
+ * Get the default remote expiration date as string
+ *
+ * @returns {string}
+ * @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 expireDateString
+ }
+
+ /**
* Are link shares password-enforced ?
*
* @returns {boolean}
@@ -151,6 +169,17 @@ export default class Config {
}
/**
+ * Is remote shares expiration enforced ?
+ *
+ * @returns {boolean}
+ * @readonly
+ * @memberof Config
+ */
+ get isDefaultRemoteExpireDateEnforced() {
+ return OC.appConfig.core.defaultRemoteExpireDateEnforced === true
+ }
+
+ /**
* Is there a default expiration date for new internal shares ?
*
* @returns {boolean}
@@ -210,6 +239,17 @@ export default class Config {
}
/**
+ * Get the default days to remote shares expiration
+ *
+ * @returns {int}
+ * @readonly
+ * @memberof Config
+ */
+ get defaultRemoteExpireDate() {
+ return OC.appConfig.core.defaultRemoteExpireDate
+ }
+
+ /**
* Is resharing allowed ?
*
* @returns {boolean}