Ghost/ghost/admin/app/components/gh-members-list-item.hbs
Kevin Ansfield 067f8d667f 🐛 Fixed members table showing dates in UTC rather than site timezone
closes https://github.com/TryGhost/Ghost/issues/13611

- added `{{moment-site-tz}}` helper for transforming any date into the selected site's timezone
  - allows for use on any date in the system
  - keeps transformation a display-level concern
- updated members table to use `{{moment-site-tz}}` to transform the date before display
2022-03-03 16:16:46 +00:00

77 lines
3.7 KiB
Handlebars

<tr data-test-list='members-list-item' data-test-member={{@member.id}}>
{{#if @member.is_loading}}
<div class="gh-list-data gh-members-list-basic gh-list-loadingcell">
<div class="gh-list-loading-title"></div>
<div class="gh-list-loading-detail"></div>
</div>
<div class="gh-list-data"></div>
<div class="gh-list-data"></div>
<div class="gh-list-data"></div>
{{#each @filterColumns}}
<div class="gh-list-data"></div>
{{/each}}
{{else}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data" data-test-table-data="details">
<div class="flex items-center">
<GhMemberAvatar @member={{@member}} @containerClass="w9 h9 mr3 flex-shrink-0" />
<div class="w-80">
<h3 class="ma0 pa0 gh-members-list-name {{unless @member.name "gh-members-name-noname"}}">{{or @member.name @member.email}}</h3>
{{#if @member.name}}
<p class="ma0 pa0 middarkgrey f8 gh-members-list-email">{{@member.email}}</p>
{{/if}}
</div>
</div>
</LinkTo>
{{#if (feature "membersTableStatus")}}
{{!-- One line: Free tier, or premium tier if there is only one premium tier --}}
{{!-- <LinkTo @route="member" @model={{@member}} class="gh-list-data">
<div>Free</div>
</LinkTo>--}}
{{!-- Two lines: Premium tier if there are multiple premium tiers --}}
{{!-- <LinkTo @route="member" @model={{@member}} class="gh-list-data">
<div>Paid</div>
<div class="midgrey">Bronze</div>
</LinkTo> --}}
{{/if}}
{{#if @newsletterEnabled}}
{{#if (feature "emailAnalytics")}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8 {{unless @member.name "gh-members-list-open-rate-noname"}}" data-test-table-data="open-rate">
{{#if (not (is-empty @member.emailOpenRate))}}
<span>{{@member.emailOpenRate}}%</span>
{{else}}
<span class="midlightgrey">N/A</span>
{{/if}}
</LinkTo>
{{/if}}
{{/if}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8 {{unless @member.name "gh-members-geolocation-noname"}}" data-test-table-data="location">
{{#if (and @member.geolocation @member.geolocation.country)}}
{{#if (and (eq @member.geolocation.country_code "US") @member.geolocation.region)}}
{{@member.geolocation.region}}, US
{{else}}
{{#if @member.geolocation.country}}
{{@member.geolocation.country}}
{{else}}
<span class="midlightgrey">Unknown</span>
{{/if}}
{{/if}}
{{else}}
<span class="midlightgrey">Unknown</span>
{{/if}}
</LinkTo>
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data="created-at">
{{#if @member.createdAtUTC}}
<div>{{moment-format (moment-site-tz @member.createdAtUTC) "D MMM YYYY"}}</div>
<div class="midlightgrey gh-members-list-subscribed-moment">{{moment-from-now @member.createdAtUTC}}</div>
{{/if}}
</LinkTo>
{{#each @filterColumns as |filterColumn|}}
<GhMembersListItemColumn @member={{@member}} @filterColumn={{filterColumn}} />
{{/each}}
{{/if}}
</tr>