mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
Merge branch 'master' into parties
Conflicts: migrations/20130129_add_missing_preferences.js
This commit is contained in:
commit
4253e12f36
3 changed files with 9 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
|||
db.users.update(
|
||||
{'preferences':{$exists:false}},
|
||||
{preferences:{$exists:false}},
|
||||
{$set:{preferences:{gender: 'm', armorSet: 'v1'}}},
|
||||
{multi:true}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -56,4 +56,5 @@ module.exports.updateUser = (user, userObj) ->
|
|||
preened = _.filter(union, (val) -> _.contains(taskIds, val))
|
||||
|
||||
# There were indeed issues found, set the new list
|
||||
user.set(path, preened) if _.size(preened) != _.size(userObj[path])
|
||||
# TODO _.difference might still be empty for duplicates in one list?
|
||||
user.set(path, preened) if _.difference(preened, userObj[path]).length != 0
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ _ = require('underscore')
|
|||
module.exports.deleteStaleAccounts = ->
|
||||
|
||||
un_registered = { "auth.local": {$exists: false} , "auth.facebook": {$exists: false} }
|
||||
registered = registered = { $or: [
|
||||
registered = { $or: [
|
||||
{ 'auth.local': { $exists: true } },
|
||||
{ 'auth.facebook': { $exists: true} }
|
||||
]};
|
||||
|
|
@ -34,5 +34,8 @@ module.exports.deleteStaleAccounts = ->
|
|||
if !!user.lastCron # for now ignore missing crons, still looking into why this is happening
|
||||
lastCron = new Date(user.lastCron)
|
||||
diff = Math.abs(moment(today).sod().diff(moment(lastCron).sod(), "days"))
|
||||
if diff > 30
|
||||
removeAccount(collection, user._id)
|
||||
if diff > 10
|
||||
removeAccount(collection, user._id)
|
||||
else
|
||||
# cron was missing for some reason
|
||||
collection.update {_id: user._id}, {$set:{lastCron: today}}, (err, res) -> throw err if err
|
||||
Loading…
Reference in a new issue