Skip to content

Commit 45da8a0

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 e4e69a0 commit 45da8a0

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
@@ -445,81 +445,6 @@ export default {
445445
...this.shareTypeToIcon(result.value.shareType),
446446
}
447447
},
448-
449-
/**
450-
* Process the new share request
451-
*
452-
* @param {object} value the multiselect option
453-
*/
454-
async addShare(value) {
455-
// Clear the displayed selection
456-
this.value = null
457-
458-
if (value.lookup) {
459-
await this.getSuggestions(this.query, true)
460-
461-
this.$nextTick(() => {
462-
// open the dropdown again
463-
this.$refs.select.$children[0].open = true
464-
})
465-
return true
466-
}
467-
468-
// handle externalResults from OCA.Sharing.ShareSearch
469-
if (value.handler) {
470-
const share = await value.handler(this)
471-
this.$emit('add:share', new Share(share))
472-
return true
473-
}
474-
475-
this.loading = true
476-
console.debug('Adding a new share from the input for', value)
477-
try {
478-
let password = null
479-
480-
if (this.config.enforcePasswordForPublicLink
481-
&& value.shareType === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
482-
password = await GeneratePassword()
483-
}
484-
485-
const path = (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/')
486-
const share = await this.createShare({
487-
path,
488-
shareType: value.shareType,
489-
shareWith: value.shareWith,
490-
password,
491-
permissions: this.fileInfo.sharePermissions & getCapabilities().files_sharing.default_permissions,
492-
attributes: JSON.stringify(this.fileInfo.shareAttributes),
493-
})
494-
495-
// If we had a password, we need to show it to the user as it was generated
496-
if (password) {
497-
share.newPassword = password
498-
// Wait for the newly added share
499-
const component = await new Promise(resolve => {
500-
this.$emit('add:share', share, resolve)
501-
})
502-
503-
// open the menu on the
504-
// freshly created share component
505-
component.open = true
506-
} else {
507-
// Else we just add it normally
508-
this.$emit('add:share', share)
509-
}
510-
511-
await this.getRecommendations()
512-
} catch (error) {
513-
this.$nextTick(() => {
514-
// open the dropdown again on error
515-
this.$refs.select.$children[0].open = true
516-
})
517-
this.query = value.shareWith
518-
console.error('Error while adding new share', error)
519-
} finally {
520-
this.loading = false
521-
}
522-
},
523448
},
524449
}
525450
</script>

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ import ShareRequests from '../mixins/ShareRequests.js'
277277
import ShareTypes from '../mixins/ShareTypes.js'
278278
import SharesMixin from '../mixins/SharesMixin.js'
279279
280-
import { subscribe } from '@nextcloud/event-bus'
281-
282280
import {
283281
ATOMIC_PERMISSIONS,
284282
BUNDLED_PERMISSIONS,
@@ -735,7 +733,6 @@ export default {
735733
736734
mounted() {
737735
this.$refs.quickPermissions?.querySelector('input:checked')?.focus()
738-
subscribe('files_sharing:external:add-share', this.handleExistingShareFromExternalSource)
739736
},
740737
741738
methods: {
@@ -1004,9 +1001,6 @@ export default {
10041001
return null // Or a default icon component if needed
10051002
}
10061003
},
1007-
handleExistingShareFromExternalSource(share) {
1008-
logger.info('Existing share from external source/app', { share })
1009-
},
10101004
},
10111005
}
10121006
</script>

0 commit comments

Comments
 (0)