From b9509265382cbad8d22cfaa848b88e6c90ec161a Mon Sep 17 00:00:00 2001 From: Justin DiRose Date: Thu, 29 Oct 2020 10:21:14 -0500 Subject: [PATCH] FIX: Payments could not complete (#28) Due to putting the Stripe Elements HTML inside an if block in the template, this caused state to be funky. As a result, calling `this.stripe.createToken` failed to return a promise. Opted instead to hide the elements via CSS for anonymous users to prevent this showstopping bug. --- assets/javascripts/discourse/templates/s/show.hbs | 3 ++- assets/stylesheets/common/subscribe.scss | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/templates/s/show.hbs b/assets/javascripts/discourse/templates/s/show.hbs index c6e1b47..41ae5a1 100644 --- a/assets/javascripts/discourse/templates/s/show.hbs +++ b/assets/javascripts/discourse/templates/s/show.hbs @@ -26,12 +26,13 @@
+ {{subscribe-card cardElement=cardElement}} + {{#if loading}} {{loading-spinner}} {{else if isAnonymous}} {{login-required}} {{else}} - {{subscribe-card cardElement=cardElement}} {{d-button disabled=loading diff --git a/assets/stylesheets/common/subscribe.scss b/assets/stylesheets/common/subscribe.scss index b8c9edd..c571235 100644 --- a/assets/stylesheets/common/subscribe.scss +++ b/assets/stylesheets/common/subscribe.scss @@ -14,6 +14,10 @@ width: 100%; } +.anon #card-element { + display: none; +} + .StripeElement { box-sizing: border-box;