Tweaked how editPath is passed to the server so it doesn't foul up validation.

This commit is contained in:
Scott Erickson 2014-05-30 14:41:41 -07:00
parent 7a9928b0c5
commit 3602f67c24
2 changed files with 4 additions and 2 deletions

View file

@ -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) =>

View file

@ -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)