diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-10-20 14:58:01 +0300 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2021-03-22 08:40:43 +0300 |
commit | c47e79fc67ce3ac4d3b3388e97bc9c697dc5d7e6 (patch) | |
tree | 1e18a7c82bf48947bbb3b6be99ca315cc4cda3ae /apps/files_sharing/src/views/SharingTab.vue | |
parent | c8e0809d435e7ad90722be3d8a3304be73d95798 (diff) |
Handle enforced password for mail shares in the WebUI
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/src/views/SharingTab.vue')
-rw-r--r-- | apps/files_sharing/src/views/SharingTab.vue | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue index 979e296d8f9..8a8d6ecf46a 100644 --- a/apps/files_sharing/src/views/SharingTab.vue +++ b/apps/files_sharing/src/views/SharingTab.vue @@ -52,12 +52,14 @@ <!-- link shares list --> <SharingLinkList v-if="!loading" + ref="linkShareList" :can-reshare="canReshare" :file-info="fileInfo" :shares="linkShares" /> <!-- other shares list --> <SharingList v-if="!loading" + ref="shareList" :shares="shares" :file-info="fileInfo" /> @@ -295,11 +297,13 @@ export default { }, /** - * Insert share at top of arrays + * Add a new share into the shares list + * and return the newly created share component * - * @param {Share} share the share to insert + * @param {Share} share the share to add to the array + * @param {Function} resolve a function to run after the share is added and its component initialized */ - addShare(share) { + addShare(share, resolve) { // only catching share type MAIL as link shares are added differently // meaning: not from the ShareInput if (share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) { @@ -307,6 +311,31 @@ export default { } else { this.shares.unshift(share) } + this.awaitForShare(share, resolve) + }, + + /** + * Await for next tick and render after the list updated + * Then resolve with the matched vue component of the + * provided share object + * + * @param {Share} share newly created share + * @param {Function} resolve a function to execute after + */ + awaitForShare(share, resolve) { + let listComponent = this.$refs.shareList + // Only mail shares comes from the input, link shares + // are managed internally in the SharingLinkList component + if (share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) { + listComponent = this.$refs.linkShareList + } + + this.$nextTick(() => { + const newShare = listComponent.$children.find(component => component.share === share) + if (newShare) { + resolve(newShare) + } + }) }, }, } |