mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
Added resource
to data available to audit log
- this allows us to hydrate the post title into the UI - needs work to support non-post and missing resources
This commit is contained in:
parent
2d1d810198
commit
83702c7e86
@ -8,11 +8,15 @@ export default class ParseAuditLogEvent extends Helper {
|
||||
const action = getAction(ev);
|
||||
const actionIcon = getActionIcon(ev);
|
||||
const getActor = () => this.store.findRecord('user', ev.actor_id, {reload: false});
|
||||
const getResource = () => this.store.findRecord(ev.resource_type, ev.resource_id, {reload: false});
|
||||
|
||||
return {
|
||||
get actor() {
|
||||
return getActor();
|
||||
},
|
||||
get resource() {
|
||||
return getResource();
|
||||
},
|
||||
actionIcon,
|
||||
action,
|
||||
original: ev
|
||||
|
@ -9,61 +9,62 @@
|
||||
<div class="view-container">
|
||||
{{#let (audit-log-event-fetcher pageSize=50) as |eventsFetcher|}}
|
||||
{{#if eventsFetcher.data}}
|
||||
<div class="gh-list-scrolling">
|
||||
<table class="gh-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Action</th>
|
||||
<th>Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each eventsFetcher.data as |event|}}
|
||||
{{#let (parse-audit-log-event event) as |ev|}}
|
||||
<tr>
|
||||
<div class="gh-list-data">
|
||||
<div class="flex items-center">
|
||||
<div class="w-80">
|
||||
<h3 class="ma0 pa0 gh-members-list-name">{{ev.actor.name}}</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gh-list-data">
|
||||
<div class="gh-members-activity-container">
|
||||
<div class="gh-members-activity-icon">{{svg-jar ev.actionIcon}}</div>
|
||||
<div class="gh-members-activity-event">
|
||||
<span class="gh-members-activity-description">
|
||||
{{capitalize-first-letter ev.action}} <strong>{{ev.original.resource_id}}</strong>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gh-list-data">{{moment-format ev.original.created_at "DD MMM YYYY HH:mm:ss"}}</div>
|
||||
</tr>
|
||||
{{/let}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="gh-list-scrolling">
|
||||
<table class="gh-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Action</th>
|
||||
<th>Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each eventsFetcher.data as |event|}}
|
||||
{{#let (parse-audit-log-event event) as |ev|}}
|
||||
<tr>
|
||||
<div class="gh-list-data">
|
||||
<div class="flex">
|
||||
<span class="user-list-item-figure" style={{background-image-style ev.actor.profileImageUrl}}>
|
||||
<span class="hidden">Photo of {{ev.actor.name}}</span>
|
||||
</span>
|
||||
<h3 class="ma0 pa0 gh-members-list-name">{{ev.actor.name}}</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gh-list-data">
|
||||
<div class="gh-members-activity-container">
|
||||
<div class="gh-members-activity-icon">{{svg-jar ev.actionIcon}}</div>
|
||||
<div class="gh-members-activity-event">
|
||||
<span class="gh-members-activity-description">
|
||||
{{capitalize-first-letter ev.action}} <strong>{{ev.resource.title}}</strong>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gh-list-data">{{moment-format ev.original.created_at "DD MMM YYYY HH:mm:ss"}}</div>
|
||||
</tr>
|
||||
{{/let}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{#if (not (or eventsFetcher.isLoading eventsFetcher.hasReachedEnd))}}
|
||||
<GhScrollTrigger @enter={{eventsFetcher.loadNextPage}} @triggerOffset={{250}} />
|
||||
<GhScrollTrigger @enter={{eventsFetcher.loadNextPage}} @triggerOffset={{250}} />
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
{{#unless eventsFetcher.isLoading}}
|
||||
<div class="no-posts-box">
|
||||
<div class="no-posts">
|
||||
{{svg-jar "activity-placeholder" class="gh-members-placeholder"}}
|
||||
<h4>No staff activity yet</h4>
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{#unless eventsFetcher.isLoading}}
|
||||
<div class="no-posts-box">
|
||||
<div class="no-posts">
|
||||
{{svg-jar "activity-placeholder" class="gh-members-placeholder"}}
|
||||
<h4>No staff activity yet</h4>
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
|
||||
{{#if eventsFetcher.isLoading}}
|
||||
<div class="no-posts-box"><GhLoadingSpinner /></div>
|
||||
{{/if}}
|
||||
{{#if eventsFetcher.isLoading}}
|
||||
<div class="no-posts-box"><GhLoadingSpinner /></div>
|
||||
{{/if}}
|
||||
{{/let}}
|
||||
</div>
|
||||
</section>
|
||||
|
Loading…
Reference in New Issue
Block a user