diff --git a/ghost/core/core/server/models/base/plugins/actions.js b/ghost/core/core/server/models/base/plugins/actions.js index 6b2113195c..f6b44747b7 100644 --- a/ghost/core/core/server/models/base/plugins/actions.js +++ b/ghost/core/core/server/models/base/plugins/actions.js @@ -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 }; diff --git a/ghost/core/core/server/models/post.js b/ghost/core/core/server/models/post.js index c5a3a79673..06b4ce14c7 100644 --- a/ghost/core/core/server/models/post.js +++ b/ghost/core/core/server/models/post.js @@ -39,7 +39,9 @@ Post = ghostBookshelf.Model.extend({ tableName: 'posts', actionsCollectCRUD: true, - actionsResourceType: 'post', + actionsResourceType: function () { + return this.get('type'); + }, /** * @NOTE