From 67bb179c257b30171df1b91fbb55cfb85de73b6d Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Thu, 11 Oct 2018 19:01:15 +0200 Subject: [PATCH] gifts: prevent users from sending the same gift twice by clicking many times on the Send button --- website/client/components/payments/sendGemsModal.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/website/client/components/payments/sendGemsModal.vue b/website/client/components/payments/sendGemsModal.vue index 98d32993c9..791ebe0ae5 100644 --- a/website/client/components/payments/sendGemsModal.vue +++ b/website/client/components/payments/sendGemsModal.vue @@ -41,7 +41,11 @@ b-modal#send-gems(:title="title", :hide-footer="true", size='lg', @hide='onHide( //include ../formatting-help .modal-footer - button.btn.btn-primary(v-if='fromBal', @click='sendGift()') {{ $t("send") }} + button.btn.btn-primary( + v-if="fromBal", + @click="sendGift()", + :disabled="sendingInProgress" + ) {{ $t("send") }} template(v-else) button.btn.btn-primary(@click='showStripe({gift, uuid: userReceivingGems._id})') {{ $t('card') }} button.btn.btn-warning(@click='openPaypalGift({gift: gift, giftedTo: userReceivingGems._id})') PayPal @@ -103,6 +107,7 @@ export default { assistanceEmailObject: { hrefTechAssistanceEmail: `${TECH_ASSISTANCE_EMAIL}`, }, + sendingInProgress: false, }; }, computed: { @@ -130,6 +135,7 @@ export default { methods: { // @TODO move to payments mixin or action (problem is that we need notifications) async sendGift () { + this.sendingInProgress = true; await this.$store.dispatch('members:transferGems', { message: this.gift.message, toUserId: this.userReceivingGems._id, @@ -139,7 +145,9 @@ export default { this.close(); }, onHide () { + this.gift.gems.amount = 0; this.gift.message = ''; + this.sendingInProgress = false; }, close () { this.$root.$emit('bv::hide::modal', 'send-gems');