Skip to content

Commit c223487

Browse files
nfebeartonge
authored andcommitted
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 <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
1 parent 80dbe54 commit c223487

4 files changed

Lines changed: 25 additions & 16 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
@@ -769,6 +769,7 @@ export default {
769769
shareWith: this.share.shareWith,
770770
attributes: this.share.attributes,
771771
note: this.share.note,
772+
fileInfo: this.fileInfo,
772773
}
773774
774775
if (this.hasExpirationDate) {
@@ -795,15 +796,6 @@ export default {
795796
* @param {object} fileInfo file data
796797
*/
797798
async addShare(share, fileInfo) {
798-
799-
// handle externalResults from OCA.Sharing.ShareSearch
800-
if (share.handler) {
801-
const shareFromHandler = await share.handler(this)
802-
this.$emit('add:share', new Share(shareFromHandler))
803-
return true
804-
}
805-
806-
// this.loading = true // Are we adding loaders the new share flow?
807799
console.debug('Adding a new share from the input for', share)
808800
try {
809801
const path = (fileInfo.path + '/' + fileInfo.name).replace('//', '/')

dist/files_sharing-files_sharing_tab.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-files_sharing_tab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)