migrate flags.rest => preferences.sleep

This commit is contained in:
Tyler Renelle 2013-12-12 20:23:32 -07:00
parent 6d0a2ad5b3
commit 5fd7ff9bbf
2 changed files with 7 additions and 4 deletions

View file

@ -10448,11 +10448,12 @@ var process=require("__browserify_process");(function() {
if (!(daysMissed > 0)) {
return;
}
user.auth.timestamps.loggedin = new Date();
user.lastCron = now;
if (user.items.lastDrop.count > 0) {
user.items.lastDrop.count = 0;
}
if (user.flags.rest === true) {
if (user.preferences.sleep === true) {
return;
}
todoTally = 0;
@ -10912,7 +10913,7 @@ var process=require("__browserify_process");(function() {
user._wrapped = true;
user.ops = {
sleep: function(req, cb) {
user.flags.rest = !user.flags.rest;
user.preferences.sleep = !user.preferences.sleep;
return cb(null, req);
},
clearCompleted: function(req, cb) {

View file

@ -317,6 +317,8 @@ api.cron = (user, options={}) ->
daysMissed = api.daysSince user.lastCron, _.defaults({now}, user.preferences)
return unless daysMissed > 0
user.auth.timestamps.loggedin = new Date()
user.lastCron = now
# Reset the lastDrop count to zero
@ -325,7 +327,7 @@ api.cron = (user, options={}) ->
# User is resting at the inn. Used to be we un-checked each daily without performing calculation (see commits before fb29e35)
# but to prevent abusing the inn (http://goo.gl/GDb9x) we now do *not* calculate dailies, and simply set lastCron to today
return if user.flags.rest is true
return if user.preferences.sleep is true
# Tally each task
todoTally = 0
@ -630,7 +632,7 @@ api.wrap = (user) ->
user.ops =
sleep: (req, cb) ->
user.flags.rest = !user.flags.rest
user.preferences.sleep = !user.preferences.sleep
cb null, req
clearCompleted: (req, cb) ->