some more comments on corrupt tasks

This commit is contained in:
Tyler Renelle
2013-04-11 11:39:54 -04:00
parent 9a8f0d799f
commit 81eb2afd9d
+4 -5
View File
@@ -22,7 +22,7 @@ _ = require('underscore')
###
Cleanup task-corruption (null tasks, rogue/invisible tasks, etc)
Obviously none of this should be happening, but we'll stop-gap until we can find & fix
Gotta love refLists! see https://github.com/lefnire/habitrpg/issues/803
Gotta love refLists! see https://github.com/lefnire/habitrpg/issues/803 & https://github.com/lefnire/habitrpg/issues/6343
###
cleanupCorruptTasks = (model) ->
user = model.at('_user')
@@ -66,13 +66,12 @@ get '/', (page, model, params, next) ->
# return page.redirect 'https://' + req.headers.host + req.url
require('./party').partySubscribe page, model, params, next, ->
user = model.at('_user')
user.setNull('apiToken', derby.uuid())
model.setNull '_user.apiToken', derby.uuid()
cleanupCorruptTasks(model) # https://github.com/lefnire/habitrpg/issues/634
require('./items').server(model)
cleanupCorruptTasks(model)
#refLists
_.each ['habit', 'daily', 'todo', 'reward'], (type) ->
model.refList "_#{type}List", "_user.tasks", "_user.#{type}Ids"