mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
adjust cron so that it prevents a double cron when timezone decreases (timezoneOffset increases)
* start to fix cron for when timezones change * add some incomplete code * change cron to identify when timezone changes and run only if both zones agree it should run - BAD - does cron an hour early one day later * change timezone offset variable names * improve handling of each individual timezone change possibility * remove unnecessary casting to number * remove duplicated code * finish code for dangerous timezone change * fix linting errors * remove console.log lines and other testing code * add a TODO comment for further actions for timezone changes in the "safe" direction
This commit is contained in:
@@ -170,8 +170,10 @@ angular.module('habitrpg')
|
||||
|
||||
authenticate: function (uuid, token, cb) {
|
||||
if (!!uuid && !!token) {
|
||||
var offset = moment().zone(); // eg, 240 - this will be converted on server as -(offset/60)
|
||||
$http.defaults.headers.common['x-api-user'] = uuid;
|
||||
$http.defaults.headers.common['x-api-key'] = token;
|
||||
$http.defaults.headers.common['x-user-timezoneOffset'] = offset;
|
||||
authenticated = true;
|
||||
settings.auth.apiId = uuid;
|
||||
settings.auth.apiToken = token;
|
||||
@@ -179,7 +181,6 @@ angular.module('habitrpg')
|
||||
if (user && user._v) user._v--; // shortcut to always fetch new updates on page reload
|
||||
userServices.log({}, function(){
|
||||
// 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});
|
||||
cb && cb();
|
||||
|
||||
Reference in New Issue
Block a user