mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
17710c3e8e
no issue - members having multiple subscriptions is not really expected but if it does happen then the most recently updated subscription is most likely to be the one that we're interested in showing the details of in the members table - added `{{most-recently-updated arr}}` helper+function that will return the item in the array argument with the most recent "updated at" value - uses `updatedAtUTC` or `updatedAt` or `updated_at` values so it will work against any of our models or un-transformed API response objects - updated `<GhMembersListItemColumn>` to use a `mostRecentSubscription` getter when showing subscription data rather than assuming the first object in the subscriptions array should be displayed
24 lines
719 B
JavaScript
24 lines
719 B
JavaScript
import Component from '@glimmer/component';
|
|
import {get} from '@ember/object';
|
|
import {mostRecentlyUpdated} from 'ghost-admin/helpers/most-recently-updated';
|
|
|
|
export default class GhMembersListItemColumn extends Component {
|
|
constructor(...args) {
|
|
super(...args);
|
|
}
|
|
|
|
get labels() {
|
|
const labelData = get(this.args.member, 'labels') || [];
|
|
return labelData.map(label => label.name).join(', ');
|
|
}
|
|
|
|
get products() {
|
|
const productData = get(this.args.member, 'products') || [];
|
|
return productData.map(product => product.name).join(', ');
|
|
}
|
|
|
|
get mostRecentSubscription() {
|
|
return mostRecentlyUpdated(get(this.args.member, 'subscriptions'));
|
|
}
|
|
}
|