From 9b9788cf110b57a080d4a4dae43c7deff0274710 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 12 Apr 2017 17:25:00 -0400 Subject: Prevent multiple clicks on post retry (#6055) --- .../post_view/components/pending_post_options.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/post_view/components/pending_post_options.jsx b/webapp/components/post_view/components/pending_post_options.jsx index c44686ffc..0085a16f2 100644 --- a/webapp/components/post_view/components/pending_post_options.jsx +++ b/webapp/components/post_view/components/pending_post_options.jsx @@ -14,13 +14,23 @@ import React from 'react'; export default class PendingPostOptions extends React.Component { constructor(props) { super(props); + this.retryPost = this.retryPost.bind(this); this.cancelPost = this.cancelPost.bind(this); + + this.submitting = false; + this.state = {}; } retryPost(e) { e.preventDefault(); + if (this.submitting) { + return; + } + + this.submitting = true; + var post = this.props.post; queuePost(post, true, null, (err) => { @@ -30,9 +40,7 @@ export default class PendingPostOptions extends React.Component { this.forceUpdate(); } - this.setState({ - submitting: false - }); + this.submitting = false; } ); -- cgit v1.2.3-1-g7c22