@@ -53,7 +53,6 @@ import debounce from 'debounce'
5353import NcSelect from ' @nextcloud/vue/dist/Components/NcSelect.js'
5454
5555import Config from ' ../services/ConfigService.js'
56- import GeneratePassword from ' ../utils/GeneratePassword.js'
5756import Share from ' ../models/Share.js'
5857import ShareRequests from ' ../mixins/ShareRequests.js'
5958import ShareTypes from ' ../mixins/ShareTypes.js'
@@ -463,81 +462,6 @@ export default {
463462 ... this .shareTypeToIcon (result .value .shareType ),
464463 }
465464 },
466-
467- /**
468- * Process the new share request
469- *
470- * @param {object} value the multiselect option
471- */
472- async addShare (value ) {
473- // Clear the displayed selection
474- this .value = null
475-
476- if (value .lookup ) {
477- await this .getSuggestions (this .query , true )
478-
479- this .$nextTick (() => {
480- // open the dropdown again
481- this .$refs .select .$children [0 ].open = true
482- })
483- return true
484- }
485-
486- // handle externalResults from OCA.Sharing.ShareSearch
487- if (value .handler ) {
488- const share = await value .handler (this )
489- this .$emit (' add:share' , new Share (share))
490- return true
491- }
492-
493- this .loading = true
494- console .debug (' Adding a new share from the input for' , value)
495- try {
496- let password = null
497-
498- if (this .config .enforcePasswordForPublicLink
499- && value .shareType === this .SHARE_TYPES .SHARE_TYPE_EMAIL ) {
500- password = await GeneratePassword ()
501- }
502-
503- const path = (this .fileInfo .path + ' /' + this .fileInfo .name ).replace (' //' , ' /' )
504- const share = await this .createShare ({
505- path,
506- shareType: value .shareType ,
507- shareWith: value .shareWith ,
508- password,
509- permissions: this .fileInfo .sharePermissions & OC .getCapabilities ().files_sharing .default_permissions ,
510- attributes: JSON .stringify (this .fileInfo .shareAttributes ),
511- })
512-
513- // If we had a password, we need to show it to the user as it was generated
514- if (password) {
515- share .newPassword = password
516- // Wait for the newly added share
517- const component = await new Promise (resolve => {
518- this .$emit (' add:share' , share, resolve)
519- })
520-
521- // open the menu on the
522- // freshly created share component
523- component .open = true
524- } else {
525- // Else we just add it normally
526- this .$emit (' add:share' , share)
527- }
528-
529- await this .getRecommendations ()
530- } catch (error) {
531- this .$nextTick (() => {
532- // open the dropdown again on error
533- this .$refs .select .$children [0 ].open = true
534- })
535- this .query = value .shareWith
536- console .error (' Error while adding new share' , error)
537- } finally {
538- this .loading = false
539- }
540- },
541465 },
542466}
543467< / script>
0 commit comments