diff options
author | fenn-cs <fenn25.fn@gmail.com> | 2023-09-11 13:55:19 +0100 |
---|---|---|
committer | fenn-cs <fenn25.fn@gmail.com> | 2023-09-13 10:18:07 +0100 |
commit | cec466ed3bdd35a7143a159eb5f46af013f87cff (patch) | |
tree | 7b08de37ebf31f87ef6b88b2c430f87459a3cf9f /apps/files_sharing | |
parent | 9037509729c073c8ba1721f745f1a4488171c270 (diff) | |
download | nextcloud-server-cec466ed3bdd35a7143a159eb5f46af013f87cff.tar.gz nextcloud-server-cec466ed3bdd35a7143a159eb5f46af013f87cff.zip |
Refactor migrated addShare method
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/src/views/SharingDetailsTab.vue | 33 |
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 7adf71ecad3..edb0e31e379 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -779,7 +779,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 { @@ -791,36 +791,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 { |