0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Remembered changed fields on destroy

refs #9248
This commit is contained in:
kirrg001 2019-02-07 11:10:26 +01:00
parent 865366c7c8
commit 1e90126760

View file

@ -396,6 +396,15 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
},
onDestroyed(model, options) {
if (!model._changed) {
model._changed = {};
}
// @NOTE: Bookshelf destroys ".changed" right after this event, but we should not throw away the information
// It is useful for webhooks, events etc.
// @NOTE: Bookshelf returns ".changed = {empty...}" on destroying (https://github.com/bookshelf/bookshelf/issues/1943)
Object.assign(model._changed, _.cloneDeep(model.changed));
addAction(model, 'deleted', options);
},