mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
possible better handling of empty POST, yan's weird User.log({}) thing.
This commit is contained in:
parent
8760d07215
commit
38d57cbc87
1 changed files with 5 additions and 2 deletions
|
|
@ -28,7 +28,6 @@ router.post '/', api.auth, (req, res, next) ->
|
||||||
{user} = req
|
{user} = req
|
||||||
actions = req.body
|
actions = req.body
|
||||||
|
|
||||||
|
|
||||||
doneCount = 1 + # cron
|
doneCount = 1 + # cron
|
||||||
_.size(actions) # standard operations
|
_.size(actions) # standard operations
|
||||||
done = (err) ->
|
done = (err) ->
|
||||||
|
|
@ -43,7 +42,11 @@ router.post '/', api.auth, (req, res, next) ->
|
||||||
res.json 200, uObj
|
res.json 200, uObj
|
||||||
console.log "Reply sent"
|
console.log "Reply sent"
|
||||||
|
|
||||||
if _.isObject(actions) and _.isEmpty(actions) then done() # first request, empty object
|
notEmpty = _.find actions, ((action) -> !_.isEmpty(action))
|
||||||
|
unless notEmpty
|
||||||
|
# yan's strange User.log({}) thing
|
||||||
|
doneCount = 1
|
||||||
|
return done()
|
||||||
|
|
||||||
misc.batchTxn model, (uObj, paths) ->
|
misc.batchTxn model, (uObj, paths) ->
|
||||||
# habitrpg-shared/algos requires uObj.habits, uObj.dailys etc instead of uObj.tasks
|
# habitrpg-shared/algos requires uObj.habits, uObj.dailys etc instead of uObj.tasks
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue