From c6d4a42467214f18c49c4f153dd007454b683533 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 4 Aug 2019 17:01:41 -0700 Subject: [PATCH] Fix cooldown when the time is an exact number of minutes. #2301 --- src/Posting/QR.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index e3881e4f1..ba78eb764 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -798,9 +798,11 @@ 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. QR.cooldown.addDelay post, 2 - else if err.textContent and (m = err.textContent.match /(?:(\d+)\s+minutes?\s+)?(\d+)\s+second/i) and !/duplicate|hour/i.test(err.textContent) + else if err.textContent and (m = err.textContent.match /\d+\s+(?:minute|second)/gi) and !/duplicate|hour/i.test(err.textContent) QR.cooldown.auto = !/have\s+been\s+muted/i.test(err.textContent) - seconds = 60 * (+(m[1]||0)) + (+m[2]) + seconds = 0 + for mi in m + seconds += (if /minute/i.test(mi) then 60 else 1) * (+mi.match(/\d+/)[0]) if /muted/i.test err.textContent QR.cooldown.addMute seconds else