From 11d9b2e0119fd5fdfcb4a074835f9a62a9dc3fbe Mon Sep 17 00:00:00 2001 From: Justin DiRose Date: Tue, 28 Jul 2020 11:08:21 -0500 Subject: [PATCH] FIX: If only one plan, automatically select it --- .../discourse/components/payment-options.js.es6 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse/components/payment-options.js.es6 b/assets/javascripts/discourse/components/payment-options.js.es6 index c19f52b..13acc30 100644 --- a/assets/javascripts/discourse/components/payment-options.js.es6 +++ b/assets/javascripts/discourse/components/payment-options.js.es6 @@ -1,9 +1,15 @@ import Component from "@ember/component"; export default Component.extend({ + init() { + this._super(...arguments); + if (this.plans.length === 1) { + this.set("selectedPlan", this.plans[0].id); + } + }, actions: { clickPlan(plan) { this.set("selectedPlan", plan.id); - } - } + }, + }, });