fix(ExternalSharing): Handle template share from external sources

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>
This commit is contained in:
fenn-cs 2024-06-24 10:19:53 +01:00
parent acb95d5c0f
commit c998f5ebba
2 changed files with 12 additions and 5 deletions

View file

@ -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)
}

View file

@ -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,
@ -735,6 +737,7 @@ export default {
mounted() {
this.$refs.quickPermissions?.querySelector('input:checked')?.focus()
subscribe('files_sharing:external:add-share', this.handleExistingShareFromExternalSource)
},
methods: {
@ -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>