Skip to content

Commit 1e87d7c

Browse files
committed
refactor(SharingInput): Remove unused addShare
The new sharing flow since NC27 requires that users open the sharing details tab and customize their share before creating it. In #39472 the work of `addShare` was handed down to `openSharingDetails` that opens the sharing details tab for the user to customize and manually creat their share. Signed-off-by: fenn-cs <[email protected]>
1 parent be0c994 commit 1e87d7c

File tree

2 files changed

+0
-82
lines changed

2 files changed

+0
-82
lines changed

apps/files_sharing/src/components/SharingInput.vue

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import debounce from 'debounce'
5353
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
5454
5555
import Config from '../services/ConfigService.js'
56-
import GeneratePassword from '../utils/GeneratePassword.js'
5756
import Share from '../models/Share.js'
5857
import ShareRequests from '../mixins/ShareRequests.js'
5958
import 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>

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,6 @@ import ShareRequests from '../mixins/ShareRequests.js'
227227
import ShareTypes from '../mixins/ShareTypes.js'
228228
import SharesMixin from '../mixins/SharesMixin.js'
229229
230-
import { subscribe } from '@nextcloud/event-bus'
231-
232230
import {
233231
ATOMIC_PERMISSIONS,
234232
BUNDLED_PERMISSIONS,
@@ -654,7 +652,6 @@ export default {
654652
655653
mounted() {
656654
this.$refs.quickPermissions?.querySelector('input:checked')?.focus()
657-
subscribe('files_sharing:external:add-share', this.handleExistingShareFromExternalSource)
658655
},
659656
660657
methods: {
@@ -916,9 +913,6 @@ export default {
916913
return null // Or a default icon component if needed
917914
}
918915
},
919-
handleExistingShareFromExternalSource(share) {
920-
logger.info('Existing share from external source/app', { share })
921-
},
922916
},
923917
}
924918
</script>

0 commit comments

Comments
 (0)