From 9956fadfbe3a139745c5284718d1033c364af8e1 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 6 Feb 2017 19:19:07 -0800 Subject: [PATCH] Connection errors and aborted posts should requeue the captcha. #1192 --- src/Posting/QR.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index f943dc842..690f147fe 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -661,6 +661,8 @@ QR = # On connection error, the post most likely didn't go through. # If the post did go through, it should be stopped by the duplicate reply cooldown. delete QR.req + Captcha.cache.save QR.currentCaptcha if QR.currentCaptcha + delete QR.currentCaptcha post.unlock() QR.cooldown.auto = true QR.cooldown.addDelay post, 2 @@ -681,6 +683,7 @@ QR = QR.status() if captcha? + QR.currentCaptcha = captcha if captcha.challenge? extra.form.append 'recaptcha_challenge_field', captcha.challenge extra.form.append 'recaptcha_response_field', captcha.response @@ -705,9 +708,12 @@ QR = $('a', err)?.target = '_blank' # duplicate image link else if (connErr = resDoc.title isnt 'Post successful!') err = QR.connectionError() + Captcha.cache.save QR.currentCaptcha if QR.currentCaptcha else if req.status isnt 200 err = "Error #{req.statusText} (#{req.status})" + delete QR.currentCaptcha + if err if /captcha|verification/i.test(err.textContent) or connErr # Remove the obnoxious 4chan Pass ad. @@ -809,6 +815,8 @@ QR = if QR.req and !QR.req.isUploadFinished QR.req.abort() delete QR.req + Captcha.cache.save QR.currentCaptcha if QR.currentCaptcha + delete QR.currentCaptcha QR.posts[0].unlock() QR.cooldown.auto = false QR.notifications.push new Notice 'info', 'QR upload aborted.', 5