mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Tweaked how editPath is passed to the server so it doesn't foul up validation.
This commit is contained in:
parent
7a9928b0c5
commit
3602f67c24
2 changed files with 4 additions and 2 deletions
|
@ -69,8 +69,9 @@ class CocoModel extends Backbone.Model
|
|||
return result.errors unless result.valid
|
||||
|
||||
save: (attrs, options) ->
|
||||
@set 'editPath', document.location.pathname
|
||||
options ?= {}
|
||||
options.headers ?= {}
|
||||
options.headers['X-Current-Path'] = document.location.pathname
|
||||
success = options.success
|
||||
error = options.error
|
||||
options.success = (model, res) =>
|
||||
|
|
|
@ -325,7 +325,8 @@ module.exports = class Handler
|
|||
newDocument.save (err) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
@sendSuccess(res, @formatEntity(req, newDocument))
|
||||
@notifyWatchersOfChange(req.user, newDocument, req.body.editPath) if @modelClass.schema.is_patchable
|
||||
if @modelClass.schema.is_patchable
|
||||
@notifyWatchersOfChange(req.user, newDocument, req.headers['x-current-path'])
|
||||
|
||||
if major?
|
||||
parentDocument.makeNewMinorVersion(updatedObject, major, done)
|
||||
|
|
Loading…
Reference in a new issue