mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
set lastCron to current moment if the user's timezone has changed when they authenticate
This commit is contained in:
@@ -182,7 +182,13 @@ angular.module('habitrpg')
|
||||
// If they don't have timezone, set it
|
||||
var offset = moment().zone(); // eg, 240 - this will be converted on server as -(offset/60)
|
||||
if (user.preferences.timezoneOffset !== offset)
|
||||
userServices.set({'preferences.timezoneOffset': offset});
|
||||
// User's timezone has changed, which can trigger a second
|
||||
// cron in one day - bad! Prevent it by setting lastCron to
|
||||
// now (plus a little bit of time in case login is slow).
|
||||
// FIXME: This can also prevent a cron that should run (but
|
||||
// that's less serious than damage from an extra cron).
|
||||
var soon = moment().add(1, 'day');
|
||||
userServices.set({'lastCron': soon, 'preferences.timezoneOffset': offset});
|
||||
cb && cb();
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user