From 6c207f5e72f3129f3c8bf4d659a4739ad2e92217 Mon Sep 17 00:00:00 2001 From: Fabien 'egg' O'Carroll Date: Fri, 10 Sep 2021 19:03:42 +0200 Subject: [PATCH] Showed created at dates for complimentary subscriptions (#2089) refs https://github.com/TryGhost/Team/issues/873 When we updated the UI to handle the default subscriptions for Complimentary subscriptions, we didn't update it to use any of the data. This updates the UI to share as much as possible for the display of subscriptions information, and only diverges for the menus which have different actions based on complimentary or not. This should ensure that we keep the UI in sync for both types of Member. * Hid Complimentary subscription CTA for members with one. --- .../components/gh-member-settings-form-cp.hbs | 72 +++++++------------ .../components/gh-member-settings-form-cp.js | 15 ++-- 2 files changed, 33 insertions(+), 54 deletions(-) diff --git a/ghost/admin/app/components/gh-member-settings-form-cp.hbs b/ghost/admin/app/components/gh-member-settings-form-cp.hbs index 118bffcd07..2abc293d39 100644 --- a/ghost/admin/app/components/gh-member-settings-form-cp.hbs +++ b/ghost/admin/app/components/gh-member-settings-form-cp.hbs @@ -165,23 +165,34 @@ {{#each product.subscriptions as |sub|}} - {{#if sub.isComplimentary}} -
+
+
-
- Complimentary + {{sub.price.nickname}} + – + {{#if sub.cancel_at_period_end}} + Has access until {{sub.validUntil}} + Cancelled + {{else}} + Renews {{sub.validUntil}} Active -
-
Created on
+ {{/if}}
-
-
-
- $ - 0 -
-
yearly
+ {{#if sub.cancellationReason}} +
Cancellation reason: {{sub.cancellationReason}}
+ {{/if}} +
Created on {{sub.startDate}}
+
+ +
+
+
+ {{sub.price.currencySymbol}} + {{sub.price.nonDecimalAmount}}
+
{{if (eq sub.price.interval "year") "yearly" "monthly"}}
+
+ {{#if sub.isComplimentary}} @@ -197,37 +208,8 @@ -
-
- {{else}} -
-
-
- {{sub.price.nickname}} - – - {{#if sub.cancel_at_period_end}} - Has access until {{sub.validUntil}} - Cancelled - {{else}} - Renews {{sub.validUntil}} - Active - {{/if}} -
- {{#if sub.cancellationReason}} -
Cancellation reason: {{sub.cancellationReason}}
- {{/if}} -
Created on {{sub.startDate}}
-
- -
-
-
- {{sub.price.currencySymbol}} - {{sub.price.nonDecimalAmount}} -
-
{{if (eq sub.price.interval "year") "yearly" "monthly"}}
-
+ {{else}} @@ -260,9 +242,9 @@ -
+ {{/if}}
- {{/if}} +
{{/each}} {{#if (and (feature "multipleProducts") (eq product.subscriptions.length 0))}} diff --git a/ghost/admin/app/components/gh-member-settings-form-cp.js b/ghost/admin/app/components/gh-member-settings-form-cp.js index 96689c37a4..f9a41167f9 100644 --- a/ghost/admin/app/components/gh-member-settings-form-cp.js +++ b/ghost/admin/app/components/gh-member-settings-form-cp.js @@ -35,16 +35,13 @@ export default class extends Component { if (!this.membersUtils.isStripeEnabled) { return false; } - if (this.feature.get('multipleProducts')) { - return true; + + let products = this.member.get('products'); + if (products && products.length > 0) { + return false; } - let subscriptions = this.member.get('subscriptions') || []; - const hasZeroPriceSub = subscriptions.filter((sub) => { - return ['active', 'trialing', 'unpaid', 'past_due'].includes(sub.status); - }).find((sub) => { - return !sub?.price?.amount; - }); - return !hasZeroPriceSub; + + return true; } get products() {