Collected Offer CRUD actions

refs https://github.com/TryGhost/Toolbox/issues/356

- this allows collection of CRUD events for Offers but we currently don't
  show them in the UI until it's overhauled to avoid being monotonously
  long
This commit is contained in:
Daniel Lockyer 2022-08-24 13:24:13 +02:00
parent 74e6b4bcf7
commit 9bdba0250a
No known key found for this signature in database
GPG Key ID: D21186F0B47295AD
3 changed files with 13 additions and 1 deletions

View File

@ -26,7 +26,7 @@ export default class AuditLogEventFilter extends Helper {
filterParts.push(`event:-[${excludedEventsArray.join(',')}]`);
}
const IGNORED_RESOURCES = ['product'];
const IGNORED_RESOURCES = ['offer', 'product'];
const excludedResourcesArray = Array.from(excludedResourcesSet).concat(IGNORED_RESOURCES).reject(isBlank);
if (excludedResourcesArray.length > 0) {
filterParts.push(`resource_type:-[${excludedResourcesArray.join(',')}]`);

View File

@ -54,6 +54,15 @@ function getLinkTarget(ev) {
route: 'settings.integration',
models: [ev.resource.id]
};
case 'offer':
if (!ev.resource.id) {
return null;
}
return {
route: 'offer',
models: [ev.resource.id]
};
case 'tag':
if (!ev.resource.slug) {
return null;

View File

@ -3,6 +3,9 @@ const ghostBookshelf = require('./base');
const Offer = ghostBookshelf.Model.extend({
tableName: 'offers',
actionsCollectCRUD: true,
actionsResourceType: 'offer',
product() {
return this.belongsTo('Product', 'product_id', 'id');
}