Skip to content

Commit

Permalink
fix(files_sharing): Stop infinite loop blocking link share requests
Browse files Browse the repository at this point in the history
Fixes infinite loop preventing share link creation requests

from being sent to the backend.

Signed-off-by: nfebe <fenn25.fn@gmail.com>
  • Loading branch information
nfebe committed Dec 9, 2024
1 parent 5131cb0 commit b5dd512
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
</template>
</NcActionInput>

<NcActionButton @click.prevent.stop="onNewLinkShare">
<NcActionButton @click.prevent.stop="onNewLinkShare(true)">
<template #icon>
<CheckIcon :size="20" />
</template>
Expand Down Expand Up @@ -575,10 +575,24 @@ export default {
},

methods: {
/**
* Check if the share requires review
*
* @param {boolean} shareReviewComplete if the share was reviewed
* @return {boolean}
*/
shareRequiresReview(shareReviewComplete) {
// If a user clicks 'Create share' it means they have reviewed the share
if (shareReviewComplete) {
return false
}
return this.defaultExpirationDateEnabled || this.config.enableLinkPasswordByDefault
},
/**
* Create a new share link and append it to the list
* @param {boolean} shareReviewComplete if the share was reviewed
*/
async onNewLinkShare() {
async onNewLinkShare(shareReviewComplete = false) {
this.logger.debug('onNewLinkShare called (with this.share)', this.share)
// do not run again if already loading
if (this.loading) {
Expand All @@ -600,7 +614,7 @@ export default {
this.pending = true
this.shareCreationComplete = false

this.logger.info('Share policy requires mandated properties (password)...')
this.logger.info('Share policy requires a review or has mandated properties (password, expirationDate)...')

// ELSE, show the pending popovermenu
// if password default or enforced, pre-fill with random one
Expand Down

0 comments on commit b5dd512

Please sign in to comment.