Skip to content

Commit 3b11104

Browse files
committed
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>
1 parent 0e64da6 commit 3b11104

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

apps/files_sharing/src/mixins/ShareDetails.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ export default {
99
// TODO : Better name/interface for handler required
1010
// For example `externalAppCreateShareHook` with proper documentation
1111
if (shareRequestObject.handler) {
12+
const handlerInput = {}
1213
if (this.suggestions) {
13-
shareRequestObject.suggestions = this.suggestions
14-
shareRequestObject.fileInfo = this.fileInfo
15-
shareRequestObject.query = this.query
14+
handlerInput.suggestions = this.suggestions
15+
handlerInput.fileInfo = this.fileInfo
16+
handlerInput.query = this.query
1617
}
17-
share = await shareRequestObject.handler(shareRequestObject)
18-
share = new Share(share)
18+
const externalShareRequestObject = await shareRequestObject.handler(handlerInput)
19+
share = this.mapShareRequestToShareObject(externalShareRequestObject)
1920
} else {
2021
share = this.mapShareRequestToShareObject(shareRequestObject)
2122
}

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ import ShareRequests from '../mixins/ShareRequests.js'
227227
import ShareTypes from '../mixins/ShareTypes.js'
228228
import SharesMixin from '../mixins/SharesMixin.js'
229229
230+
import { subscribe } from '@nextcloud/event-bus'
231+
230232
import {
231233
ATOMIC_PERMISSIONS,
232234
BUNDLED_PERMISSIONS,
@@ -652,6 +654,7 @@ export default {
652654
653655
mounted() {
654656
this.$refs.quickPermissions?.querySelector('input:checked')?.focus()
657+
subscribe('files_sharing:external:add-share', this.handleExistingShareFromExternalSource)
655658
},
656659
657660
methods: {
@@ -913,6 +916,9 @@ export default {
913916
return null // Or a default icon component if needed
914917
}
915918
},
919+
handleExistingShareFromExternalSource(share) {
920+
logger.info('Existing share from external source/app', { share })
921+
},
916922
},
917923
}
918924
</script>

0 commit comments

Comments
 (0)