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 committed Jul 3, 2024
1 parent acb95d5 commit c998f5e
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 @@ -15,13 +15,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 @@ -279,6 +279,8 @@ import ShareTypes from '../mixins/ShareTypes.js'
import SharesMixin from '../mixins/SharesMixin.js'
import logger from '../services/logger.ts'

import { subscribe } from '@nextcloud/event-bus'

import {
ATOMIC_PERMISSIONS,
BUNDLED_PERMISSIONS,
Expand Down Expand Up @@ -735,6 +737,7 @@ export default {

mounted() {
this.$refs.quickPermissions?.querySelector('input:checked')?.focus()
subscribe('files_sharing:external:add-share', this.handleExistingShareFromExternalSource)
},

methods: {
Expand Down Expand Up @@ -1007,6 +1010,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 c998f5e

Please sign in to comment.