Skip to content

Commit 0f94c99

Browse files
committed
Fix invite guest for new sharing flow
Call external handlers such as the one in the guess app https://github.com/nextcloud/guests/blob/master/src/main.js#L30 if present. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
1 parent e94a83a commit 0f94c99

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

apps/files_sharing/src/mixins/ShareDetails.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,29 @@ import Share from '../models/Share.js'
22

33
export default {
44
methods: {
5-
openSharingDetails(share) {
6-
const shareRequestObject = {
5+
async openSharingDetails(shareRequestObject) {
6+
let share = {}
7+
// handle externalResults from OCA.Sharing.ShareSearch
8+
// TODO : Better name/interface for handler required
9+
// For example `externalAppCreateShareHook` with proper documentation
10+
if (shareRequestObject.handler) {
11+
if (this.suggestions) {
12+
shareRequestObject.suggestions = this.suggestions
13+
shareRequestObject.fileInfo = this.fileInfo
14+
shareRequestObject.query = this.query
15+
}
16+
share = await shareRequestObject.handler(shareRequestObject)
17+
share = new Share(share)
18+
} else {
19+
share = this.mapShareRequestToShareObject(shareRequestObject)
20+
}
21+
22+
const shareDetails = {
723
fileInfo: this.fileInfo,
8-
share: this.mapShareRequestToShareObject(share),
24+
share,
925
}
10-
this.$emit('open-sharing-details', shareRequestObject)
26+
27+
this.$emit('open-sharing-details', shareDetails)
1128
},
1229
openShareDetailsForCustomSettings(share) {
1330
share.setCustomPermissions = true

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ export default {
774774
shareWith: this.share.shareWith,
775775
attributes: this.share.attributes,
776776
note: this.share.note,
777+
fileInfo: this.fileInfo,
777778
}
778779
779780
if (this.hasExpirationDate) {
@@ -800,15 +801,6 @@ export default {
800801
* @param {object} fileInfo file data
801802
*/
802803
async addShare(share, fileInfo) {
803-
804-
// handle externalResults from OCA.Sharing.ShareSearch
805-
if (share.handler) {
806-
const shareFromHandler = await share.handler(this)
807-
this.$emit('add:share', new Share(shareFromHandler))
808-
return true
809-
}
810-
811-
// this.loading = true // Are we adding loaders the new share flow?
812804
console.debug('Adding a new share from the input for', share)
813805
try {
814806
const path = (fileInfo.path + '/' + fileInfo.name).replace('//', '/')

0 commit comments

Comments
 (0)