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 <fenn25.fn@gmail.com>
  • Loading branch information
nfebe authored and backportbot[bot] committed Jul 3, 2024
1 parent 45e17b1 commit dbe1bd5
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 @@ -273,6 +273,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 @@ -729,6 +731,7 @@ export default {
mounted() {
this.$refs.quickPermissions?.querySelector('input:checked')?.focus()
subscribe('files_sharing:external:add-share', this.handleExistingShareFromExternalSource)
},
methods: {
Expand Down Expand Up @@ -997,6 +1000,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 dbe1bd5

Please sign in to comment.