mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
Fixes bug when user attempts to create task with no value field
This commit is contained in:
parent
367ca4a76b
commit
4113eefaf1
1 changed files with 5 additions and 3 deletions
|
|
@ -87,9 +87,9 @@ validateTask = (req, res, next) ->
|
|||
unless /^(habit|todo|daily|reward)$/.test type
|
||||
return res.json 400, err: 'type must be habit, todo, daily, or reward'
|
||||
|
||||
text = sanitize(text).xss()
|
||||
notes = sanitize(notes).xss()
|
||||
value = sanitize(value).toInt()
|
||||
newTask.text = sanitize(text).xss()
|
||||
newTask.notes = sanitize(notes).xss()
|
||||
newTask.value = sanitize(value).toInt()
|
||||
|
||||
switch type
|
||||
when 'habit'
|
||||
|
|
@ -98,6 +98,8 @@ 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