Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-02-12 11:57:19 +0300
committernpmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>2021-02-19 14:16:38 +0300
commit9073c09c62686cd4d5b674adcab347afde71b890 (patch)
tree8620a975a39c558e8e7ecd0b2c6590629253d33e /apps/files_sharing/src
parent946430862e63a2b1fdbb49ced4942b1534292606 (diff)
Avoid creating two share links when password is enforced
Signed-off-by: Julius Härtl <jus@bitgrid.net> Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/components/SharingEntryLink.vue27
1 files changed, 21 insertions, 6 deletions
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index 522e8e23355..44c3c986e17 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -44,7 +44,7 @@
</Actions>
<!-- pending actions -->
- <Actions v-if="!loading && (pendingPassword || pendingExpirationDate)"
+ <Actions v-if="!pending && (pendingPassword || pendingExpirationDate)"
class="sharing-entry__actions"
menu-align="right"
:open.sync="open"
@@ -308,7 +308,7 @@
<!-- Create new share -->
<ActionButton v-else-if="canReshare"
class="new-share-link"
- icon="icon-add"
+ :icon="loading ? 'icon-loading-small' : 'icon-add'"
@click.prevent.stop="onNewLinkShare">
{{ t('files_sharing', 'Create a new share link') }}
</ActionButton>
@@ -373,6 +373,9 @@ export default {
copySuccess: true,
copied: false,
+ // Are we waiting for password/expiration date
+ pending: false,
+
publicUploadRWValue: OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_READ | OC.PERMISSION_DELETE,
publicUploadRValue: OC.PERMISSION_READ,
publicUploadWValue: OC.PERMISSION_CREATE,
@@ -618,6 +621,11 @@ export default {
* Create a new share link and append it to the list
*/
async onNewLinkShare() {
+ // do not run again if already loading
+ if (this.loading) {
+ return
+ }
+
const shareDefaults = {
share_type: OC.Share.SHARE_TYPE_LINK,
}
@@ -630,11 +638,13 @@ export default {
shareDefaults.password = await this.generatePassword()
}
- // do not push yet if we need a password or an expiration date
+ // do not push yet if we need a password or an expiration date: show pending menu
if (this.config.enforcePasswordForPublicLink || this.config.isDefaultExpireDateEnforced) {
- this.loading = true
+ this.pending = true
+
// if a share already exists, pushing it
if (this.share && !this.share.id) {
+ // if the share is valid, create it on the server
if (this.checkShare(this.share)) {
await this.pushNewLinkShare(this.share, true)
return true
@@ -660,10 +670,10 @@ export default {
// open the menu on the
// freshly created share component
this.open = false
- this.loading = false
+ this.pending = false
component.open = true
- // Nothing enforced, creating share directly
+ // Nothing is enforced, creating share directly
} else {
const share = new Share(shareDefaults)
await this.pushNewLinkShare(share)
@@ -680,6 +690,11 @@ export default {
*/
async pushNewLinkShare(share, update) {
try {
+ // do nothing if we're already pending creation
+ if (this.loading) {
+ return true
+ }
+
this.loading = true
this.errors = {}