mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Process shares only once, better debug and expiration date code
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
This commit is contained in:
parent
91487d8739
commit
31172a0cd9
5 changed files with 24 additions and 22 deletions
14
apps/files_sharing/js/dist/files_sharing_tab.js
vendored
14
apps/files_sharing/js/dist/files_sharing_tab.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export default {
|
|||
* ! This allow vue to make the Share class state reactive
|
||||
* ! do not remove it ot you'll lose all reactivity here
|
||||
*/
|
||||
reactiveState: this.share && this.share.state,
|
||||
reactiveState: this.share?.state,
|
||||
|
||||
SHARE_TYPES: {
|
||||
SHARE_TYPE_USER: OC.Share.SHARE_TYPE_USER,
|
||||
|
|
|
|||
|
|
@ -189,10 +189,6 @@ export default {
|
|||
},
|
||||
},
|
||||
|
||||
beforeMount() {
|
||||
this.getShares()
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* Get the existing shares infos
|
||||
|
|
@ -284,6 +280,8 @@ export default {
|
|||
|
||||
this.linkShares = shares.filter(share => share.type === this.SHARE_TYPES.SHARE_TYPE_LINK || share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL)
|
||||
this.shares = shares.filter(share => share.type !== this.SHARE_TYPES.SHARE_TYPE_LINK && share.type !== this.SHARE_TYPES.SHARE_TYPE_EMAIL)
|
||||
console.debug('Processed', this.linkShares.length, 'link share(s)')
|
||||
console.debug('Processed', this.shares.length, 'share(s)')
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue