Skip to content

Commit

Permalink
fix(ExternalSharing): Handle template share from external sources
Browse files Browse the repository at this point in the history
The new sharing flow requires or implies that users should edit share before creating.
External sources should not created the share IF we would upon sharing details tab on first request.

Signed-off-by: fenn-cs <[email protected]>
  • Loading branch information
nfebe authored and backportbot[bot] committed Jul 3, 2024
1 parent 9b16b36 commit 303170b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apps/files_sharing/src/mixins/ShareDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ export default {
// TODO : Better name/interface for handler required
// For example `externalAppCreateShareHook` with proper documentation
if (shareRequestObject.handler) {
const handlerInput = {}
if (this.suggestions) {
shareRequestObject.suggestions = this.suggestions
shareRequestObject.fileInfo = this.fileInfo
shareRequestObject.query = this.query
handlerInput.suggestions = this.suggestions
handlerInput.fileInfo = this.fileInfo
handlerInput.query = this.query
}
share = await shareRequestObject.handler(shareRequestObject)
share = new Share(share)
const externalShareRequestObject = await shareRequestObject.handler(handlerInput)
share = this.mapShareRequestToShareObject(externalShareRequestObject)
} else {
share = this.mapShareRequestToShareObject(shareRequestObject)
}
Expand Down
6 changes: 6 additions & 0 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ import ShareRequests from '../mixins/ShareRequests.js'
import ShareTypes from '../mixins/ShareTypes.js'
import SharesMixin from '../mixins/SharesMixin.js'
import { subscribe } from '@nextcloud/event-bus'
import {
ATOMIC_PERMISSIONS,
BUNDLED_PERMISSIONS,
Expand Down Expand Up @@ -649,6 +651,7 @@ export default {
mounted() {
this.$refs.quickPermissions?.querySelector('input:checked')?.focus()
subscribe('files_sharing:external:add-share', this.handleExistingShareFromExternalSource)
},
methods: {
Expand Down Expand Up @@ -906,6 +909,9 @@ export default {
return null // Or a default icon component if needed
}
},
handleExistingShareFromExternalSource(share) {
logger.info('Existing share from external source/app', { share })
},
},
}
</script>
Expand Down

0 comments on commit 303170b

Please sign in to comment.