From 13ac8af6654a6068ec1ded364a45e01f3eea6560 Mon Sep 17 00:00:00 2001 From: nfebe Date: Mon, 9 Dec 2024 01:20:20 +0100 Subject: [PATCH] fix(files_sharing): Stop infinite loop blocking link share requests Fixes infinite loop preventing share link creation requests from being sent to the backend. Signed-off-by: nfebe [skip ci] --- .../src/components/SharingEntryLink.vue | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue index 71a7937c957b4..945473be481fb 100644 --- a/apps/files_sharing/src/components/SharingEntryLink.vue +++ b/apps/files_sharing/src/components/SharingEntryLink.vue @@ -115,7 +115,7 @@ - + @@ -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) { @@ -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