Ghost/ghost/admin/app/components/dashboard/latest-member-activity.hbs
Kevin Ansfield acbc4233a8 Humanized event details on members activity screen
refs https://github.com/TryGhost/Team/issues/1277

- moved event parsing from a component to a helper
  - keeps code as a plain function
  - allows for per-event parsing which helps with rendering as we're not rebuilding/re-rendering a whole array each time the events data changes when a new page is loaded
  - updated to include full member and email objects (will be used later for email preview popup)
- updated members-activity table row component to use the event parser helper for better event details
2022-01-25 11:50:10 +00:00

58 lines
3.1 KiB
Handlebars

{{#if this.shouldDisplay}}
<div class="gh-dashboard-box grey activity-feed" data-test-dashboard-member-activity>
<h4 class="gh-dashboard-header">Activity feed</h4>
<div class="content">
{{#let (members-event-fetcher filter=(if (feature "membersActivityFeed") "type:-[email_delivered_event,email_opened_event,email_failed_event]") pageSize=5) as |eventsFetcher|}}
{{#if eventsFetcher.isLoading}}
Loading...
{{/if}}
{{#if eventsFetcher.isError}}
<p class="error">
There was an error loading events
{{#if eventsFetcher.errorMessage}}
<code>{{eventsFetcher.errorMessage}}</code>
{{/if}}
</p>
{{/if}}
{{#unless (or eventsFetcher.isLoading eventsFetcher.isError)}}
<div class="gh-event-timeline">
{{#if eventsFetcher.data}}
<ul class="gh-dashboard-activity-feed">
{{#each eventsFetcher.data as |event|}}
{{#let (parse-member-event event) as |parsedEvent|}}
<li data-test-dashboard-member-activity-item>
<LinkTo class="member-details" @route="member" @model="{{parsedEvent.memberId}}">
<div class="activity">
<div>
<span class="member">{{parsedEvent.subject}}</span>
{{parsedEvent.action}}
{{parsedEvent.object}}
<span class="highlight">{{parsedEvent.info}}</span>
</div>
</div>
</LinkTo>
<span class="time">{{moment-from-now parsedEvent.timestamp}}</span>
</li>
{{/let}}
{{/each}}
</ul>
{{else}}
<div class="gh-no-data-list" data-test-no-member-activities>
{{svg-jar "no-data-list"}}
<span>No member activity available.</span>
</div>
{{/if}}
</div>
{{#if (feature "membersActivityFeed")}}
<div class="gh-dashboard-top-members-footer">
<LinkTo @route="members-activity">See all activity {{svg-jar "arrow-right"}}</LinkTo>
</div>
{{/if}}
{{/unless}}
{{/let}}
</div>
</div>
{{/if}}