mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
Fixed patch fetches to handle when the patches are targeting strings instead of ObjectIds.
This commit is contained in:
parent
141e11f918
commit
685c3b3318
1 changed files with 6 additions and 1 deletions
|
@ -255,7 +255,12 @@ module.exports = class Handler
|
|||
res.end()
|
||||
|
||||
getPatchesFor: (req, res, id) ->
|
||||
query = { 'target.original': mongoose.Types.ObjectId(id), status: req.query.status or 'pending' }
|
||||
query =
|
||||
$or: [
|
||||
{'target.original': id+''}
|
||||
{'target.original': mongoose.Types.ObjectId(id)}
|
||||
]
|
||||
status: req.query.status or 'pending'
|
||||
Patch.find(query).sort('-created').exec (err, patches) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
patches = (patch.toObject() for patch in patches)
|
||||
|
|
Loading…
Reference in a new issue