Skip to content

Commit f2bfcdc

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 <fenn25.fn@gmail.com>
1 parent dbe1bd5 commit f2bfcdc

File tree

2 files changed

+0
-81
lines changed

2 files changed

+0
-81
lines changed

apps/files_sharing/src/components/SharingInput.vue

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -462,81 +462,6 @@ export default {
462462
...this.shareTypeToIcon(result.value.shareType),
463463
}
464464
},
465-
466-
/**
467-
* Process the new share request
468-
*
469-
* @param {object} value the multiselect option
470-
*/
471-
async addShare(value) {
472-
// Clear the displayed selection
473-
this.value = null
474-
475-
if (value.lookup) {
476-
await this.getSuggestions(this.query, true)
477-
478-
this.$nextTick(() => {
479-
// open the dropdown again
480-
this.$refs.select.$children[0].open = true
481-
})
482-
return true
483-
}
484-
485-
// handle externalResults from OCA.Sharing.ShareSearch
486-
if (value.handler) {
487-
const share = await value.handler(this)
488-
this.$emit('add:share', new Share(share))
489-
return true
490-
}
491-
492-
this.loading = true
493-
console.debug('Adding a new share from the input for', value)
494-
try {
495-
let password = null
496-
497-
if (this.config.enforcePasswordForPublicLink
498-
&& value.shareType === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
499-
password = await GeneratePassword()
500-
}
501-
502-
const path = (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/')
503-
const share = await this.createShare({
504-
path,
505-
shareType: value.shareType,
506-
shareWith: value.shareWith,
507-
password,
508-
permissions: this.fileInfo.sharePermissions & getCapabilities().files_sharing.default_permissions,
509-
attributes: JSON.stringify(this.fileInfo.shareAttributes),
510-
})
511-
512-
// If we had a password, we need to show it to the user as it was generated
513-
if (password) {
514-
share.newPassword = password
515-
// Wait for the newly added share
516-
const component = await new Promise(resolve => {
517-
this.$emit('add:share', share, resolve)
518-
})
519-
520-
// open the menu on the
521-
// freshly created share component
522-
component.open = true
523-
} else {
524-
// Else we just add it normally
525-
this.$emit('add:share', share)
526-
}
527-
528-
await this.getRecommendations()
529-
} catch (error) {
530-
this.$nextTick(() => {
531-
// open the dropdown again on error
532-
this.$refs.select.$children[0].open = true
533-
})
534-
this.query = value.shareWith
535-
console.error('Error while adding new share', error)
536-
} finally {
537-
this.loading = false
538-
}
539-
},
540465
},
541466
}
542467
</script>

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,6 @@ import ShareRequests from '../mixins/ShareRequests.js'
273273
import ShareTypes from '../mixins/ShareTypes.js'
274274
import SharesMixin from '../mixins/SharesMixin.js'
275275
276-
import { subscribe } from '@nextcloud/event-bus'
277-
278276
import {
279277
ATOMIC_PERMISSIONS,
280278
BUNDLED_PERMISSIONS,
@@ -731,7 +729,6 @@ export default {
731729
732730
mounted() {
733731
this.$refs.quickPermissions?.querySelector('input:checked')?.focus()
734-
subscribe('files_sharing:external:add-share', this.handleExistingShareFromExternalSource)
735732
},
736733
737734
methods: {
@@ -1000,9 +997,6 @@ export default {
1000997
return null // Or a default icon component if needed
1001998
}
1002999
},
1003-
handleExistingShareFromExternalSource(share) {
1004-
logger.info('Existing share from external source/app', { share })
1005-
},
10061000
},
10071001
}
10081002
</script>

0 commit comments

Comments
 (0)