From e13221279d4c719f55f3068594874f82635e70ef Mon Sep 17 00:00:00 2001 From: Justin DiRose Date: Mon, 19 Oct 2020 20:54:30 -0500 Subject: [PATCH] FIX: Loading state persists after bad card entered (#22) * FIX: Loading state persists after bad card entered If a bad card number was entered and the subscribe button clicked, the subscription button still disappeared and subscribing was not possible without refreshing the page. * UX: Add missing tooltip * DEV: Ignore gems directory for local rubocop runs --- .rubocop.yml | 3 +++ Gemfile.lock | 1 + assets/javascripts/discourse/controllers/s-show.js.es6 | 1 + config/locales/client.en.yml | 3 +++ 4 files changed, 8 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index d46296c..65a20e9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,2 +1,5 @@ +AllCops: + Exclude: + - 'gems/**/*' inherit_gem: rubocop-discourse: default.yml diff --git a/Gemfile.lock b/Gemfile.lock index f828da5..a9998d6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,7 @@ GIT translations-manager (0.6) GEM + remote: https://rubygems.org/ specs: ast (2.4.1) parallel (1.19.2) diff --git a/assets/javascripts/discourse/controllers/s-show.js.es6 b/assets/javascripts/discourse/controllers/s-show.js.es6 index b5be2b6..0d1c5f7 100644 --- a/assets/javascripts/discourse/controllers/s-show.js.es6 +++ b/assets/javascripts/discourse/controllers/s-show.js.es6 @@ -25,6 +25,7 @@ export default Controller.extend({ createSubscription(plan) { return this.stripe.createToken(this.get("cardElement")).then((result) => { if (result.error) { + this.set("loading", false); return result; } else { const customer = Customer.create({ source: result.token.id }); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 4c199f9..c75c454 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -9,6 +9,9 @@ en: errors: discourse_patrons_amount_must_be_currency: "Currency amounts must be currencies without dollar symbol (eg 1.50)" js: + filters: + subscribe: + help: Support this site by subscribing discourse_subscriptions: title: Discourse Subscriptions admin_navigation: Subscriptions