From b5bc870a3bdfb84f2bb5b8526a4672ee64062eae Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 26 Aug 2021 13:08:20 +0530 Subject: [PATCH] Handled dummy subscription for comped members refs https://github.com/TryGhost/Team/issues/986#issuecomment-900281186 The tiers features updated the "comped" functionality to no longer create a Stripe Subscription for members. Since theme developers expect comped members will have a subscription, we added a dummy subscription object for comped members in API. Since Admin previously expected comped members to be ones without any subscription but access to product, this change updates Admin behavior to identify comped subscriptions on a product and show them the same way as before. --- .../components/gh-member-settings-form-cp.hbs | 154 +++++++++++------- .../components/gh-member-settings-form-cp.js | 3 +- 2 files changed, 97 insertions(+), 60 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 1ad515bb34..46adb5079b 100644 --- a/ghost/admin/app/components/gh-member-settings-form-cp.hbs +++ b/ghost/admin/app/components/gh-member-settings-form-cp.hbs @@ -145,68 +145,104 @@ {{#each product.subscriptions as |sub|}} -
-
-
- {{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 sub.isComplimentary}} +
+
+
+ Complimentary + Active +
+
Created on
-
{{if (eq sub.price.interval "year") "yearly" "monthly"}}
-
- - - - - {{svg-jar "dotdotdot"}} - +
+
+
+ $ + 0 +
+
yearly
+
+ + + + {{svg-jar "dotdotdot"}} + + + + +
  • + +
  • +
    - - -
  • - - View Stripe customer - -
  • -
  • -
  • - - View Stripe subscription - -
  • -
  • - {{#if sub.cancel_at_period_end}} - - {{else}} - +
  • +
    + {{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"}}
    +
    + + + + + {{svg-jar "dotdotdot"}} + + + + +
  • + + View Stripe customer + +
  • +
  • +
  • + + View Stripe subscription + +
  • +
  • + {{#if sub.cancel_at_period_end}} + + {{else}} + + {{/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 2a3ffbbcf1..96689c37a4 100644 --- a/ghost/admin/app/components/gh-member-settings-form-cp.js +++ b/ghost/admin/app/components/gh-member-settings-form-cp.js @@ -62,7 +62,8 @@ export default class extends Component { ...sub.price, currencySymbol: getSymbol(sub.price.currency), nonDecimalAmount: getNonDecimal(sub.price.amount) - } + }, + isComplimentary: !sub.id }; });