mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 04:43:12 +03:00
Fixed page actions events stored as posts
- this was due to the fact that we use the same model for pages as we do for posts, so the hardcoded `post` key was not accurate - this commit adds support for providing a function to return the key for the action type
This commit is contained in:
parent
9fda97550d
commit
bde9b84221
@ -23,11 +23,17 @@ module.exports = function (Bookshelf) {
|
||||
return;
|
||||
}
|
||||
|
||||
let resourceType = this.actionsResourceType;
|
||||
|
||||
if (typeof resourceType === 'function') {
|
||||
resourceType = resourceType.bind(this)();
|
||||
}
|
||||
|
||||
// @TODO: implement context
|
||||
return {
|
||||
event: event,
|
||||
resource_id: this.id || this.previous('id'),
|
||||
resource_type: this.actionsResourceType,
|
||||
resource_type: resourceType,
|
||||
actor_id: actor.id,
|
||||
actor_type: actor.type
|
||||
};
|
||||
|
@ -39,7 +39,9 @@ Post = ghostBookshelf.Model.extend({
|
||||
tableName: 'posts',
|
||||
|
||||
actionsCollectCRUD: true,
|
||||
actionsResourceType: 'post',
|
||||
actionsResourceType: function () {
|
||||
return this.get('type');
|
||||
},
|
||||
|
||||
/**
|
||||
* @NOTE
|
||||
|
Loading…
Reference in New Issue
Block a user