2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Use previousAttributes when model is destroyed

fixes #5589
This commit is contained in:
Fabian Becker 2015-07-20 14:20:43 +02:00
parent 27ecb3b211
commit 4500b14989
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');
});
},