mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
fix problem when updating task
This commit is contained in:
parent
4113eefaf1
commit
3139e51535
1 changed files with 4 additions and 5 deletions
|
|
@ -84,12 +84,13 @@ validateTask = (req, res, next) ->
|
|||
type = undefined
|
||||
delete newTask.type
|
||||
else if req.method is 'POST'
|
||||
newTask.value = sanitize(value).toInt()
|
||||
newTask.value = 0 if isNaN newTask.value
|
||||
unless /^(habit|todo|daily|reward)$/.test type
|
||||
return res.json 400, err: 'type must be habit, todo, daily, or reward'
|
||||
|
||||
newTask.text = sanitize(text).xss()
|
||||
newTask.notes = sanitize(notes).xss()
|
||||
newTask.value = sanitize(value).toInt()
|
||||
newTask.text = sanitize(text).xss() if typeof text is "string"
|
||||
newTask.notes = sanitize(notes).xss() if typeof notes is "string"
|
||||
|
||||
switch type
|
||||
when 'habit'
|
||||
|
|
@ -98,8 +99,6 @@ validateTask = (req, res, next) ->
|
|||
when 'daily', 'todo'
|
||||
newTask.completed = false unless typeof completed is 'boolean'
|
||||
|
||||
newTask.value = 0 if isNaN newTask.value
|
||||
|
||||
_.extend task, newTask
|
||||
req.task = task
|
||||
next()
|
||||
|
|
|
|||
Loading…
Reference in a new issue