Fix cooldowns never expiring.
Conflicts: src/Posting/QR.cooldown.coffee
This commit is contained in:
parent
9b384f44a8
commit
0af1575796
@ -15,8 +15,7 @@ QR.cooldown =
|
|||||||
QR.cooldown.start()
|
QR.cooldown.start()
|
||||||
$.sync key, QR.cooldown.sync
|
$.sync key, QR.cooldown.sync
|
||||||
start: ->
|
start: ->
|
||||||
return unless Conf['Cooldown']
|
return if QR.cooldown.isCounting or !Object.keys(QR.cooldown.cooldowns).length
|
||||||
return if QR.cooldown.isCounting
|
|
||||||
QR.cooldown.isCounting = true
|
QR.cooldown.isCounting = true
|
||||||
QR.cooldown.count()
|
QR.cooldown.count()
|
||||||
|
|
||||||
@ -69,6 +68,7 @@ QR.cooldown =
|
|||||||
{types, cooldowns, upSpd, upSpdAccuracy} = QR.cooldown
|
{types, cooldowns, upSpd, upSpdAccuracy} = QR.cooldown
|
||||||
|
|
||||||
for start, cooldown of cooldowns
|
for start, cooldown of cooldowns
|
||||||
|
start = +start
|
||||||
if 'delay' of cooldown
|
if 'delay' of cooldown
|
||||||
if cooldown.delay
|
if cooldown.delay
|
||||||
seconds = Math.max seconds, cooldown.delay--
|
seconds = Math.max seconds, cooldown.delay--
|
||||||
@ -80,8 +80,10 @@ QR.cooldown =
|
|||||||
if isReply is cooldown.isReply
|
if isReply is cooldown.isReply
|
||||||
# Only cooldowns relevant to this post can set the seconds variable:
|
# Only cooldowns relevant to this post can set the seconds variable:
|
||||||
# reply cooldown with a reply, thread cooldown with a thread
|
# reply cooldown with a reply, thread cooldown with a thread
|
||||||
elapsed = Math.floor (now - start) / $.SECOND
|
elapsed = (now - start) // $.SECOND
|
||||||
continue if elapsed < 0 # clock changed since then?
|
if elapsed < 0 # clock changed since then?
|
||||||
|
QR.cooldown.unset start
|
||||||
|
continue
|
||||||
type = unless isReply
|
type = unless isReply
|
||||||
'thread'
|
'thread'
|
||||||
else if hasFile
|
else if hasFile
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user