Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</NcActionText>
<NcActionInput v-if="pendingExpirationDate"
class="share-link-expire-date"
:disabled="saving"
:disabled="saving || isExpiryDateEnforced"
:is-native-picker="true"
:hide-label="true"
:value="new Date(share.expireDate)"
Expand Down Expand Up @@ -302,34 +302,12 @@ export default {
}
return null
},

/**
* Does the current share have an expiration date
*
* @return {boolean}
*/
hasExpirationDate: {
get() {
return this.config.isDefaultExpireDateEnforced
|| !!this.share.expireDate
},
set(enabled) {
const defaultExpirationDate = this.config.defaultExpirationDate
|| new Date(new Date().setDate(new Date().getDate() + 1))
this.share.expireDate = enabled
? this.formatDateToString(defaultExpirationDate)
: ''
console.debug('Expiration date status', enabled, this.share.expireDate)
},
},

dateMaxEnforced() {
if (this.config.isDefaultExpireDateEnforced) {
return new Date(new Date().setDate(new Date().getDate() + this.config.defaultExpireDate))
}
return null
},

/**
* Is the current share password protected ?
*
Expand Down
9 changes: 9 additions & 0 deletions apps/files_sharing/src/mixins/SharesMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ export default {
isShareOwner() {
return this.share && this.share.owner === getCurrentUser().uid
},
isExpiryDateEnforced() {
if (this.isPublicShare) {
return this.config.isDefaultExpireDateEnforced
}
if (this.isRemoteShare) {
return this.config.isDefaultRemoteExpireDateEnforced || this.config.isDefaultExpireDateEnforced
}
return this.config.isDefaultInternalExpireDateEnforced || this.config.isDefaultExpireDateEnforced
},
hasCustomPermissions() {
const bundledPermissions = [
BUNDLED_PERMISSIONS.ALL,
Expand Down
13 changes: 8 additions & 5 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,13 @@ export default {
*/
hasExpirationDate: {
get() {
return !!this.share.expireDate || this.config.isDefaultInternalExpireDateEnforced
if (this.isPublicShare) {
return !!this.share.expireDate || this.config.isDefaultExpireDateEnforced
}
if (this.isRemoteShare) {
return !!this.share.expireDate || this.config.isDefaultInternalExpireDateEnforced || this.config.isDefaultExpireDateEnforced
}
return !!this.share.expireDate || this.config.isDefaultInternalExpireDateEnforced || this.config.isDefaultExpireDateEnforced
},
set(enabled) {
this.share.expireDate = enabled
Expand Down Expand Up @@ -393,7 +399,7 @@ export default {
return this.fileInfo.type === 'dir'
},
dateMaxEnforced() {
if (!this.isRemote && this.config.isDefaultInternalExpireDateEnforced) {
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))
Expand Down Expand Up @@ -422,9 +428,6 @@ export default {
isPasswordEnforced() {
return this.isPublicShare && this.config.enforcePasswordForPublicLink
},
isExpiryDateEnforced() {
return this.config.isDefaultInternalExpireDateEnforced
},
defaultExpiryDate() {
if ((this.isGroupShare || this.isUserShare) && this.config.isDefaultInternalExpireDateEnabled) {
return new Date(this.config.defaultInternalExpirationDate)
Expand Down
4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.