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:
commit
3cf164f403
2 changed files with 4 additions and 1 deletions
|
@ -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();
|
||||
|
|
|
@ -107,7 +107,6 @@ Post = ghostBookshelf.Model.extend({
|
|||
if (model.previous('status') === 'published') {
|
||||
model.emitChange('unpublished');
|
||||
}
|
||||
|
||||
model.emitChange('deleted');
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue