mirror of
https://github.com/nextcloud/server.git
synced 2026-06-06 15:23:17 -04:00
Merge pull request #46280 from nextcloud/backport/46068/stable28
[stable28] fix(ExternalSharing): Handle template shares from external sources
This commit is contained in:
commit
47c74a9dd3
9 changed files with 13 additions and 87 deletions
|
|
@ -462,81 +462,6 @@ export default {
|
|||
...this.shareTypeToIcon(result.value.shareType),
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Process the new share request
|
||||
*
|
||||
* @param {object} value the multiselect option
|
||||
*/
|
||||
async addShare(value) {
|
||||
// Clear the displayed selection
|
||||
this.value = null
|
||||
|
||||
if (value.lookup) {
|
||||
await this.getSuggestions(this.query, true)
|
||||
|
||||
this.$nextTick(() => {
|
||||
// open the dropdown again
|
||||
this.$refs.select.$children[0].open = true
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// handle externalResults from OCA.Sharing.ShareSearch
|
||||
if (value.handler) {
|
||||
const share = await value.handler(this)
|
||||
this.$emit('add:share', new Share(share))
|
||||
return true
|
||||
}
|
||||
|
||||
this.loading = true
|
||||
console.debug('Adding a new share from the input for', value)
|
||||
try {
|
||||
let password = null
|
||||
|
||||
if (this.config.enforcePasswordForPublicLink
|
||||
&& value.shareType === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
|
||||
password = await GeneratePassword()
|
||||
}
|
||||
|
||||
const path = (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/')
|
||||
const share = await this.createShare({
|
||||
path,
|
||||
shareType: value.shareType,
|
||||
shareWith: value.shareWith,
|
||||
password,
|
||||
permissions: this.fileInfo.sharePermissions & getCapabilities().files_sharing.default_permissions,
|
||||
attributes: JSON.stringify(this.fileInfo.shareAttributes),
|
||||
})
|
||||
|
||||
// If we had a password, we need to show it to the user as it was generated
|
||||
if (password) {
|
||||
share.newPassword = password
|
||||
// Wait for the newly added share
|
||||
const component = await new Promise(resolve => {
|
||||
this.$emit('add:share', share, resolve)
|
||||
})
|
||||
|
||||
// open the menu on the
|
||||
// freshly created share component
|
||||
component.open = true
|
||||
} else {
|
||||
// Else we just add it normally
|
||||
this.$emit('add:share', share)
|
||||
}
|
||||
|
||||
await this.getRecommendations()
|
||||
} catch (error) {
|
||||
this.$nextTick(() => {
|
||||
// open the dropdown again on error
|
||||
this.$refs.select.$children[0].open = true
|
||||
})
|
||||
this.query = value.shareWith
|
||||
console.error('Error while adding new share', error)
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -9,13 +9,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)
|
||||
}
|
||||
|
|
|
|||
3
dist/4133-4133.js
vendored
Normal file
3
dist/4133-4133.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/4133-4133.js.map
vendored
Normal file
1
dist/4133-4133.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3
dist/5552-5552.js
vendored
3
dist/5552-5552.js
vendored
File diff suppressed because one or more lines are too long
1
dist/5552-5552.js.map
vendored
1
dist/5552-5552.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files_sharing-files_sharing_tab.js
vendored
4
dist/files_sharing-files_sharing_tab.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_sharing-files_sharing_tab.js.map
vendored
2
dist/files_sharing-files_sharing_tab.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue