mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
allow cron to record user's current timezone offset in preferences.timezoneOffsetAtLastCron (initial stage of cron timezone fix for https://github.com/HabitRPG/habitrpg/issues/3806 )
This commit is contained in:
@@ -36,6 +36,9 @@ module.exports = function(user, options) {
|
||||
}
|
||||
user.auth.timestamps.loggedin = new Date();
|
||||
user.lastCron = now;
|
||||
if (_.isFinite(+user.preferences.timezoneOffset)) {
|
||||
user.preferences.timezoneOffsetAtLastCron = user.preferences.timezoneOffset;
|
||||
}
|
||||
if (user.items.lastDrop.count > 0) {
|
||||
user.items.lastDrop.count = 0;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ let beforeAfter = (options = {}) => {
|
||||
before.preferences.dayStart = after.preferences.dayStart = options.dayStart;
|
||||
}
|
||||
before.preferences.timezoneOffset = after.preferences.timezoneOffset = options.timezoneOffset || moment().zone();
|
||||
before.preferences.timezoneOffsetAtLastCron = after.preferences.timezoneOffsetAtLastCron = before.preferences.timezoneOffset;
|
||||
if (options.limitOne) {
|
||||
before[`${options.limitOne}s`] = [before[`${options.limitOne}s`][0]];
|
||||
after[`${options.limitOne}s`] = [after[`${options.limitOne}s`][0]];
|
||||
|
||||
@@ -350,6 +350,7 @@ var UserSchema = new Schema({
|
||||
skin: {type:String, 'default':'915533'},
|
||||
shirt: {type: String, 'default': 'blue'},
|
||||
timezoneOffset: Number,
|
||||
timezoneOffsetAtLastCron: Number,
|
||||
sound: {type:String, 'default':'off', enum: ['off', 'danielTheBard', 'gokulTheme', 'luneFoxTheme', 'wattsTheme']},
|
||||
language: String,
|
||||
automaticAllocation: Boolean,
|
||||
|
||||
Reference in New Issue
Block a user