Ghost/ghost/admin/app/components/settings/history/table.hbs
Simon Backx fbed93b866
🐛 Added missing history logs for post/page bulk actions (#16734)
no issue

The post/page bulk actions weren't logged in the history log / actions
table.

This change adds support for logging bulk actions.
- New `addActions` static method on models. It creates an action log in
the database for multiple models at once. If only one model was edited,
deleted or added, it will fallback to `addAction`
- `addAction` can also be called statically now
- `actionName` option is now supported when using `addActions`,
`addAction`, and as a result also in all bulk manipulation methods, and
CRUD methods. This allows you to replace the default '5 posts edited'
into something more specific like '5 posts featured'
- Fixed support for null resource_id in the parse-history-event helper
- Removed the default 'published' status requirement when using
Post.findOne for internal queries.
2023-05-05 09:45:36 +02:00

72 lines
3.7 KiB
Handlebars

<table class="gh-list gh-history-table">
<thead>
<tr>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{{#each @events as |event|}}
{{#let (parse-history-event event) as |ev|}}
<tr>
<div class="gh-list-data">
<div class="gh-history-object flex items-center ma3">
<span class="user-list-item-figure" style={{background-image-style ev.actorIcon}}>
{{#if ev.actor.name}}
<span class="hidden">Photo of {{ev.actor.name}}</span>
{{/if}}
<div class="gh-history-icon">{{svg-jar ev.actionIcon}}</div>
</span>
{{!-- --}}
<div>
<div class="gh-history-description">
<span>
{{capitalize-first-letter ev.action}}{{#unless ev.isBulkAction}}:{{/unless}}
</span>
{{#unless ev.isBulkAction}}
{{#if ev.contextResource}}
<span>
<span>{{capitalize-first-letter ev.contextResource.first}}</span>
{{#if (not-eq ev.contextResource.first ev.contextResource.second)}}
<code>({{ev.contextResource.second}})</code>
{{/if}}
</span>
{{else if (or ev.original.resource.title ev.original.resource.name ev.original.context.primary_name)}}
{{#if ev.linkTarget}}
{{#if ev.linkTarget.models}}
<LinkTo @route={{ev.linkTarget.route}} @models={{ev.linkTarget.models}} class="permalink fw6">
{{or ev.original.resource.title ev.original.resource.name}}
</LinkTo>
{{else}}
<LinkTo @route={{ev.linkTarget.route}} class="permalink fw6">
{{or ev.original.resource.title ev.original.resource.name}}
</LinkTo>
{{/if}}
{{else}}
<span>{{or ev.original.resource.title ev.original.resource.name ev.original.context.primary_name}}</span>
{{/if}}
{{else}}
<span class="midlightgrey">(unknown)</span>
{{/if}}
{{/unless}}
<span class="gh-history-name">
<span class="midgrey">&ndash; by </span>
{{#if ev.actorLinkTarget}}
<LinkTo @route={{ev.actorLinkTarget.route}} @models={{ev.actorLinkTarget.models}}>
{{ev.actor.name}}
</LinkTo>
{{else}}
(deleted user)
{{/if}}
</span>
</div>
<div class="gh-history-datetime">{{moment-format ev.original.created_at "DD MMM YYYY | HH:mm:ss"}}</div>
</div>
</div>
</div>
</tr>
{{/let}}
{{/each}}
</tbody>
</table>