mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
prevent cron running if the lastCron date is in the future
This commit is contained in:
@@ -1697,14 +1697,10 @@ api.wrap = (user, main=true) ->
|
|||||||
cron: (options={}) ->
|
cron: (options={}) ->
|
||||||
now = +options.now || +new Date
|
now = +options.now || +new Date
|
||||||
|
|
||||||
# They went to a different timezone
|
if moment(user.lastCron).isAfter(now)
|
||||||
# FIXME:
|
# This might not be taking timezone into consideration.
|
||||||
# (1) This exit-early code isn't taking timezone into consideration!!
|
user.lastCron = now
|
||||||
# (2) Won't switching timezones be handled automatically client-side anyway? (aka, can we just remove this code?)
|
return
|
||||||
# (3) And if not, is this the correct way to handle switching timezones
|
|
||||||
# if moment(user.lastCron).isAfter(now)
|
|
||||||
# user.lastCron = now
|
|
||||||
# return
|
|
||||||
|
|
||||||
daysMissed = api.daysSince user.lastCron, _.defaults({now}, user.preferences)
|
daysMissed = api.daysSince user.lastCron, _.defaults({now}, user.preferences)
|
||||||
return unless daysMissed > 0
|
return unless daysMissed > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user