mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Fixed actions not stored when deleting posts
- if a model is being deleted, `attributes` is an empty object and the data we actually need is in `_previousAttributes` - because of this, only fetching the type using `.get` returned the wrong value, and the Action model validator would throw an error because we tried to insert an empty type - we can access the previous value using `.previous(..)` - this commit fixes saving actions when deleting a post by fetching the type from the previous attributes if the current attributes is empty
This commit is contained in:
parent
1fadbacdec
commit
ddd79494b0
1 changed files with 1 additions and 1 deletions
|
@ -40,7 +40,7 @@ Post = ghostBookshelf.Model.extend({
|
|||
|
||||
actionsCollectCRUD: true,
|
||||
actionsResourceType: function () {
|
||||
return this.get('type');
|
||||
return this.get('type') || this.previous('type');
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue