mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-04 01:43:40 -04: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
|
return result.errors unless result.valid
|
||||||
|
|
||||||
save: (attrs, options) ->
|
save: (attrs, options) ->
|
||||||
@set 'editPath', document.location.pathname
|
|
||||||
options ?= {}
|
options ?= {}
|
||||||
|
options.headers ?= {}
|
||||||
|
options.headers['X-Current-Path'] = document.location.pathname
|
||||||
success = options.success
|
success = options.success
|
||||||
error = options.error
|
error = options.error
|
||||||
options.success = (model, res) =>
|
options.success = (model, res) =>
|
||||||
|
|
|
@ -325,7 +325,8 @@ module.exports = class Handler
|
||||||
newDocument.save (err) =>
|
newDocument.save (err) =>
|
||||||
return @sendDatabaseError(res, err) if err
|
return @sendDatabaseError(res, err) if err
|
||||||
@sendSuccess(res, @formatEntity(req, newDocument))
|
@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?
|
if major?
|
||||||
parentDocument.makeNewMinorVersion(updatedObject, major, done)
|
parentDocument.makeNewMinorVersion(updatedObject, major, done)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue