From 8c712d62bfc1381c1228546ad597325cba6f2fd8 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Wed, 6 Jan 2021 11:56:15 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20blank=20data=20in=20memb?= =?UTF-8?q?er=20customer=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs https://github.com/TryGhost/Ghost-Admin/commit/772f5fa766febd8a6a0f1639299f1078d589b3bc - 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 `` 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 --- .../app/components/gh-member-settings-form.hbs | 17 +++++++++-------- .../app/components/gh-member-settings-form.js | 10 ++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ghost/admin/app/components/gh-member-settings-form.hbs b/ghost/admin/app/components/gh-member-settings-form.hbs index 6767d78ac5..7f24c94c52 100644 --- a/ghost/admin/app/components/gh-member-settings-form.hbs +++ b/ghost/admin/app/components/gh-member-settings-form.hbs @@ -216,6 +216,7 @@ {{/each}} {{else}} +
@@ -223,16 +224,16 @@ Stripe customer ID - - {{subscription.customer.id}} + + {{customer.id}} Name - {{#if subscription.customer.name}} - {{subscription.customer.name}} + {{#if customer.name}} + {{customer.name}} {{else}} No name {{/if}} @@ -241,8 +242,8 @@ Email - {{#if subscription.customer.email}} - {{subscription.customer.email}} + {{#if customer.email}} + {{customer.email}} {{else}} No email {{/if}} @@ -251,8 +252,8 @@ Customer since - {{#if subscription.startDate}} - {{subscription.startDate}} + {{#if customer.startDate}} + {{customer.startDate}} {{else}} No data {{/if}} diff --git a/ghost/admin/app/components/gh-member-settings-form.js b/ghost/admin/app/components/gh-member-settings-form.js index 5f6ded3f6b..eaca3a8bcf 100644 --- a/ghost/admin/app/components/gh-member-settings-form.js +++ b/ghost/admin/app/components/gh-member-settings-form.js @@ -56,6 +56,16 @@ export default Component.extend({ 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: { setProperty(property, value) { this.setProperty(property, value);