Fix cooldown when the time is an exact number of minutes. #2301

This commit is contained in:
ccd0 2019-08-04 17:01:41 -07:00
parent 9eed6ee89e
commit c6d4a42467

View File

@ -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