1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

🐛 Fixed blank data in member customer tab

refs 5e1b78abe2

- when pulling the customer data display out of the subscriptions loop the data output was not updated to match
- adds a `customer` property to the `<GhMemberSettingsForm>` backing class that pulls the customer data from the first available subscription and adds the `startDate` property. Using the first available customer record works because there's a 1:1 mapping of member to stripe customer
This commit is contained in:
Kevin Ansfield 2021-01-06 11:56:15 +00:00
parent d809614223
commit be080c5604
2 changed files with 19 additions and 8 deletions

View file

@ -216,6 +216,7 @@
</section> </section>
{{/each}} {{/each}}
{{else}} {{else}}
<section class="gh-member-stripe-info pa5 pb0 pt4 flex flex-column flex-row-ns items-start justify-between"> <section class="gh-member-stripe-info pa5 pb0 pt4 flex flex-column flex-row-ns items-start justify-between">
<div class="flex items-start w-100"> <div class="flex items-start w-100">
<div class="flex-auto"> <div class="flex-auto">
@ -223,16 +224,16 @@
<tr class="gh-member-stripe-row"> <tr class="gh-member-stripe-row">
<td class="gh-member-stripe-label">Stripe customer ID</td> <td class="gh-member-stripe-label">Stripe customer ID</td>
<td class="gh-member-stripe-data gh-member-stripe-id"> <td class="gh-member-stripe-data gh-member-stripe-id">
<a href="https://dashboard.stripe.com/customers/{{subscription.customer.id}}" target="_blank" rel="noopener" data-tooltip="View on Stripe"> <a href="https://dashboard.stripe.com/customers/{{customer.id}}" target="_blank" rel="noopener" data-tooltip="View on Stripe">
{{subscription.customer.id}} {{customer.id}}
</a> </a>
</td> </td>
</tr> </tr>
<tr class="gh-member-stripe-row"> <tr class="gh-member-stripe-row">
<td class="gh-member-stripe-label">Name</td> <td class="gh-member-stripe-label">Name</td>
<td class="gh-member-stripe-data"> <td class="gh-member-stripe-data">
{{#if subscription.customer.name}} {{#if customer.name}}
{{subscription.customer.name}} {{customer.name}}
{{else}} {{else}}
<span class="midgrey-d1">No name</span> <span class="midgrey-d1">No name</span>
{{/if}} {{/if}}
@ -241,8 +242,8 @@
<tr class="gh-member-stripe-row"> <tr class="gh-member-stripe-row">
<td class="gh-member-stripe-label">Email</td> <td class="gh-member-stripe-label">Email</td>
<td class="gh-member-stripe-data gh-member-stripe-email"> <td class="gh-member-stripe-data gh-member-stripe-email">
{{#if subscription.customer.email}} {{#if customer.email}}
{{subscription.customer.email}} {{customer.email}}
{{else}} {{else}}
<span class="midgrey-d1">No email</span> <span class="midgrey-d1">No email</span>
{{/if}} {{/if}}
@ -251,8 +252,8 @@
<tr class="gh-member-stripe-row"> <tr class="gh-member-stripe-row">
<td class="gh-member-stripe-label">Customer since</td> <td class="gh-member-stripe-label">Customer since</td>
<td class="gh-member-stripe-data"> <td class="gh-member-stripe-data">
{{#if subscription.startDate}} {{#if customer.startDate}}
{{subscription.startDate}} {{customer.startDate}}
{{else}} {{else}}
<span class="midgrey-d1">No data</span> <span class="midgrey-d1">No data</span>
{{/if}} {{/if}}

View file

@ -56,6 +56,16 @@ export default Component.extend({
return null; return null;
}), }),
customer: computed('subscriptions.[]', function () {
let customer = this.subscriptions.firstObject?.customer;
if (customer) {
return Object.assign({}, this.subscriptions.firstObject?.customer, {
startDate: this.subscriptions.firstObject?.startDate
});
}
return null;
}),
actions: { actions: {
setProperty(property, value) { setProperty(property, value) {
this.setProperty(property, value); this.setProperty(property, value);