From 62122f6a966b1f8ac402d36a9471e45d742ba698 Mon Sep 17 00:00:00 2001 From: saltrafael <76502841+saltrafael@users.noreply.github.com> Date: Mon, 6 Dec 2021 11:51:07 -0300 Subject: [PATCH] Only allow to resubmit a tip when a previous has completed or failed (#429) --- ui/component/commentCreate/view.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/component/commentCreate/view.jsx b/ui/component/commentCreate/view.jsx index 558e90031..74d1ddbd7 100644 --- a/ui/component/commentCreate/view.jsx +++ b/ui/component/commentCreate/view.jsx @@ -246,7 +246,9 @@ export function CommentCreate(props: Props) { } function doSubmitTip() { - if (!activeChannelClaim) return; + if (!activeChannelClaim || isSubmitting) return; + + setSubmitting(true); const params = { amount: tipAmount, claim_id: claimId, channel_id: activeChannelClaim.claim_id }; const activeChannelName = activeChannelClaim && activeChannelClaim.name; @@ -256,8 +258,6 @@ export function CommentCreate(props: Props) { const channelClaimId = claim.signing_channel ? claim.signing_channel.claim_id : claim.claim_id; const tipChannelName = claim.signing_channel ? claim.signing_channel.name : claim.name; - setSubmitting(true); - if (activeTab === TAB_LBC) { // call sendTip and then run the callback from the response // second parameter is callback @@ -309,8 +309,11 @@ export function CommentCreate(props: Props) { * @param {string} [environment] Optional environment for Stripe (test|live) */ function handleCreateComment(txid, payment_intent_id, environment) { + if (isSubmitting) return; + setShowEmotes(false); setSubmitting(true); + const stickerValue = selectedSticker && buildValidSticker(selectedSticker.name); createComment(stickerValue || commentValue, claimId, parentId, txid, payment_intent_id, environment, !!stickerValue)