mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
Merge branch 'develop'
This commit is contained in:
commit
69d8d478da
3 changed files with 8 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'
|
||||
|
||||
text = sanitize(text).xss()
|
||||
notes = sanitize(notes).xss()
|
||||
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'
|
||||
|
|
|
|||
|
|
@ -159,6 +159,8 @@ describe 'API', ->
|
|||
expect(res.body.id).not.to.be.empty()
|
||||
# Ensure that user owns the newly created object
|
||||
expect(user.get().tasks[res.body.id]).to.be.an('object')
|
||||
# Ensure that value gets set to 0 since not otherwise specified
|
||||
expect(user.get().tasks[res.body.id].value).to.be.equal(0)
|
||||
done()
|
||||
|
||||
it 'PUT /api/v1/user/task/:id', (done) ->
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
<option>{:hatchingPotion}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<button type=submit>Sprinkle</button>
|
||||
<button type=submit>Pour</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue