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:
Daniel Lockyer 2022-08-17 14:43:01 +02:00
parent 2d1d810198
commit 83702c7e86
No known key found for this signature in database
GPG Key ID: D21186F0B47295AD
2 changed files with 55 additions and 50 deletions

View File

@ -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

View File

@ -23,18 +23,19 @@
{{#let (parse-audit-log-event event) as |ev|}}
<tr>
<div class="gh-list-data">
<div class="flex items-center">
<div class="w-80">
<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>
<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>
{{capitalize-first-letter ev.action}} <strong>{{ev.resource.title}}</strong>
</span>
</div>
</div>