4444 </Actions >
4545
4646 <!-- pending actions -->
47- <Actions v-if =" ! loading && (pendingPassword || pendingExpirationDate )"
47+ <Actions v-if =" ! pending && (pendingPassword || pendingExpirationDate )"
4848 class="sharing-entry__actions"
4949 menu-align="right"
5050 :open .sync =" open "
308308 <!-- Create new share -->
309309 <ActionButton v-else-if =" canReshare "
310310 class="new-share-link"
311- icon="icon-add"
311+ : icon =" loading ? ' icon-loading-small ' : ' icon- add' "
312312 @click .prevent .stop =" onNewLinkShare " >
313313 {{ t('files_sharing', 'Create a new share link') }}
314314 </ActionButton >
@@ -373,6 +373,9 @@ export default {
373373 copySuccess: true ,
374374 copied: false ,
375375
376+ // Are we waiting for password/expiration date
377+ pending: false ,
378+
376379 publicUploadRWValue: OC .PERMISSION_UPDATE | OC .PERMISSION_CREATE | OC .PERMISSION_READ | OC .PERMISSION_DELETE ,
377380 publicUploadRValue: OC .PERMISSION_READ ,
378381 publicUploadWValue: OC .PERMISSION_CREATE ,
@@ -618,6 +621,11 @@ export default {
618621 * Create a new share link and append it to the list
619622 */
620623 async onNewLinkShare () {
624+ // do not run again if already loading
625+ if (this .loading ) {
626+ return
627+ }
628+
621629 const shareDefaults = {
622630 share_type: OC .Share .SHARE_TYPE_LINK ,
623631 }
@@ -630,11 +638,13 @@ export default {
630638 shareDefaults .password = await this .generatePassword ()
631639 }
632640
633- // do not push yet if we need a password or an expiration date
641+ // do not push yet if we need a password or an expiration date: show pending menu
634642 if (this .config .enforcePasswordForPublicLink || this .config .isDefaultExpireDateEnforced ) {
635- this .loading = true
643+ this .pending = true
644+
636645 // if a share already exists, pushing it
637646 if (this .share && ! this .share .id ) {
647+ // if the share is valid, create it on the server
638648 if (this .checkShare (this .share )) {
639649 await this .pushNewLinkShare (this .share , true )
640650 return true
@@ -660,10 +670,10 @@ export default {
660670 // open the menu on the
661671 // freshly created share component
662672 this .open = false
663- this .loading = false
673+ this .pending = false
664674 component .open = true
665675
666- // Nothing enforced, creating share directly
676+ // Nothing is enforced, creating share directly
667677 } else {
668678 const share = new Share (shareDefaults)
669679 await this .pushNewLinkShare (share)
@@ -680,6 +690,11 @@ export default {
680690 */
681691 async pushNewLinkShare (share , update ) {
682692 try {
693+ // do nothing if we're already pending creation
694+ if (this .loading ) {
695+ return true
696+ }
697+
683698 this .loading = true
684699 this .errors = {}
685700
0 commit comments