From d539d4ca5389d8e8b03be4f28ff98b3e77c4521a Mon Sep 17 00:00:00 2001 From: Rish Date: Thu, 4 Feb 2021 11:56:26 +0530 Subject: [PATCH] Revert "Updated usage of subscriptions data for members (#1834)" This reverts commit fbd42ef33e3c601f91ac25aea17b4a65c5ca9f6b. --- ghost/admin/app/components/gh-member-settings-form.js | 6 +++--- ghost/admin/app/models/member.js | 2 +- ghost/admin/app/transforms/member-subscription.js | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ghost/admin/app/components/gh-member-settings-form.js b/ghost/admin/app/components/gh-member-settings-form.js index 15e58c3c71..eaca3a8bcf 100644 --- a/ghost/admin/app/components/gh-member-settings-form.js +++ b/ghost/admin/app/components/gh-member-settings-form.js @@ -20,7 +20,7 @@ export default Component.extend({ // Allowed actions setProperty: () => {}, - hasMultipleSubscriptions: gt('member.subscriptions', 1), + hasMultipleSubscriptions: gt('member.stripe', 1), canShowStripeInfo: computed('member.isNew', 'membersUtils.isStripeEnabled', function () { let stripeEnabled = this.membersUtils.isStripeEnabled; @@ -32,8 +32,8 @@ export default Component.extend({ } }), - subscriptions: computed('member.subscriptions', function () { - let subscriptions = this.member.get('subscriptions'); + subscriptions: computed('member.stripe', function () { + let subscriptions = this.member.get('stripe'); if (subscriptions && subscriptions.length > 0) { return subscriptions.map((subscription) => { const statusLabel = subscription.status ? subscription.status.replace('_', ' ') : ''; diff --git a/ghost/admin/app/models/member.js b/ghost/admin/app/models/member.js index e6f0326490..16406a56b0 100644 --- a/ghost/admin/app/models/member.js +++ b/ghost/admin/app/models/member.js @@ -10,7 +10,7 @@ export default Model.extend(ValidationEngine, { email: attr('string'), note: attr('string'), createdAtUTC: attr('moment-utc'), - subscriptions: attr('member-subscription'), + stripe: attr('member-subscription'), subscribed: attr('boolean', {defaultValue: true}), comped: attr('boolean', {defaultValue: false}), geolocation: attr('json-string'), diff --git a/ghost/admin/app/transforms/member-subscription.js b/ghost/admin/app/transforms/member-subscription.js index 29c1831aa0..9e2324ab0b 100644 --- a/ghost/admin/app/transforms/member-subscription.js +++ b/ghost/admin/app/transforms/member-subscription.js @@ -6,7 +6,7 @@ export default Transform.extend({ deserialize(serialized) { let subscriptions, subscriptionArray; - subscriptionArray = serialized || []; + subscriptionArray = serialized.subscriptions || []; subscriptions = subscriptionArray.map(itemDetails => MemberSubscription.create(itemDetails)); @@ -24,6 +24,8 @@ export default Transform.extend({ subscriptionArray = []; } - return subscriptionArray; + return { + subscriptions: subscriptionArray + }; } });