0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00

Merge pull request #5590 from halfdan/fix/5589

Use previousAttributes when model is destroyed
This commit is contained in:
Hannah Wolfe 2015-07-20 18:50:57 +01:00
commit 3cf164f403
2 changed files with 4 additions and 1 deletions

View file

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

View file

@ -107,7 +107,6 @@ Post = ghostBookshelf.Model.extend({
if (model.previous('status') === 'published') {
model.emitChange('unpublished');
}
model.emitChange('deleted');
});
},