aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2023-09-11 13:55:19 +0100
committerfenn-cs <fenn25.fn@gmail.com>2023-09-12 20:50:49 +0100
commitef996400955db8c631a2a3d995b356edfe0ca4bc (patch)
tree18608d9acb7444ebe5c8d4ce7390f4e17088e09a /apps/files_sharing/src
parent4b349b107a4e71783f5169e4d2d5be0ddc2433e3 (diff)
downloadnextcloud-server-ef996400955db8c631a2a3d995b356edfe0ca4bc.tar.gz
nextcloud-server-ef996400955db8c631a2a3d995b356edfe0ca4bc.zip
Refactor migrated addShare method
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/views/SharingDetailsTab.vue33
1 files changed, 15 insertions, 18 deletions
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue
index 6368bb20b9f..d77688df2d7 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -784,7 +784,7 @@ export default {
incomingShare.password = this.share.password
}
- const share = await this.addShare(incomingShare, this.fileInfo, this.config)
+ const share = await this.addShare(incomingShare, this.fileInfo)
this.share = share
this.$emit('add:share', this.share)
} else {
@@ -796,36 +796,33 @@ export default {
/**
* Process the new share request
*
- * @param {object} value the multiselect option
+ * @param {Share} share incoming share object
* @param {object} fileInfo file data
- * @param {Config} config instance configs
*/
- async addShare(value, fileInfo, config) {
- // Clear the displayed selection
- this.value = null
+ async addShare(share, fileInfo) {
// handle externalResults from OCA.Sharing.ShareSearch
- if (value.handler) {
- const share = await value.handler(this)
- this.$emit('add:share', new Share(share))
+ if (share.handler) {
+ const shareFromHandler = await share.handler(this)
+ this.$emit('add:share', new Share(shareFromHandler))
return true
}
// this.loading = true // Are we adding loaders the new share flow?
- console.debug('Adding a new share from the input for', value)
+ console.debug('Adding a new share from the input for', share)
try {
const path = (fileInfo.path + '/' + fileInfo.name).replace('//', '/')
- const share = await this.createShare({
+ const resultingShare = await this.createShare({
path,
- shareType: value.shareType,
- shareWith: value.shareWith,
- permissions: value.permissions,
+ shareType: share.shareType,
+ shareWith: share.shareWith,
+ permissions: share.permissions,
attributes: JSON.stringify(fileInfo.shareAttributes),
- ...(value.note ? { note: value.note } : {}),
- ...(value.password ? { password: value.password } : {}),
- ...(value.expireDate ? { expireDate: value.expireDate } : {}),
+ ...(share.note ? { note: share.note } : {}),
+ ...(share.password ? { password: share.password } : {}),
+ ...(share.expireDate ? { expireDate: share.expireDate } : {}),
})
- return share
+ return resultingShare
} catch (error) {
console.error('Error while adding new share', error)
} finally {