Skip to content

Commit

Permalink
Use previousAttributes when model is destroyed
Browse files Browse the repository at this point in the history
fixes #5589
  • Loading branch information
halfdan committed Jul 20, 2015
1 parent 27ecb3b commit 4500b14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/server/data/xml/sitemap/base-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ _.extend(BaseSiteMapGenerator.prototype, {

removeUrl: function (model) {
var datum = model.toJSON();
// When the model is destroyed we need to fetch previousAttributes
if (!datum.id) {
datum = model.previousAttributes();
}
this.removeFromLookups(datum);

this.lastModified = Date.now();
Expand Down
1 change: 0 additions & 1 deletion core/server/models/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ Post = ghostBookshelf.Model.extend({
if (model.previous('status') === 'published') {
model.emitChange('unpublished');
}

model.emitChange('deleted');
});
},
Expand Down

0 comments on commit 4500b14

Please sign in to comment.