From 3ecc6f68ca19470347754f021ef5ce607778455e Mon Sep 17 00:00:00 2001 From: Rish Date: Fri, 11 Oct 2019 14:04:39 +0530 Subject: [PATCH] Renamed member require payment setting no issue Renames member setting `requirePaymentForsSignup` -> `allowSelfSignup` to match existing usage in members API --- app/components/gh-members-lab-setting.js | 8 ++++---- app/controllers/settings/labs.js | 20 ------------------- .../components/gh-members-lab-setting.hbs | 10 +++++----- mirage/fixtures/settings.js | 2 +- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/app/components/gh-members-lab-setting.js b/app/components/gh-members-lab-setting.js index 42f31bfa9..13392ba0c 100644 --- a/app/components/gh-members-lab-setting.js +++ b/app/components/gh-members-lab-setting.js @@ -21,7 +21,7 @@ export default Component.extend({ yearly: yearlyPlan }; subscriptionSettings.stripeConfig = stripeProcessor.config; - subscriptionSettings.requirePaymentForSetup = !!subscriptionSettings.requirePaymentForSetup; + subscriptionSettings.allowSelfSignup = !!subscriptionSettings.allowSelfSignup; subscriptionSettings.fromAddress = subscriptionSettings.fromAddress || 'noreply'; return subscriptionSettings; @@ -59,8 +59,8 @@ export default Component.extend({ return plan; }); } - if (key === 'requirePaymentForSignup') { - subscriptionSettings.requirePaymentForSignup = !subscriptionSettings.requirePaymentForSignup; + if (key === 'allowSelfSignup') { + subscriptionSettings.allowSelfSignup = !subscriptionSettings.allowSelfSignup; } if (key === 'fromAddress') { subscriptionSettings.fromAddress = event.target.value; @@ -75,7 +75,7 @@ export default Component.extend({ } catch (e) { return { isPaid: false, - requirePaymentForSignup: false, + allowSelfSignup: true, fromAddress: 'noreply', paymentProcessors: [{ adapter: 'stripe', diff --git a/app/controllers/settings/labs.js b/app/controllers/settings/labs.js index b23c41557..7963d93bd 100644 --- a/app/controllers/settings/labs.js +++ b/app/controllers/settings/labs.js @@ -8,7 +8,6 @@ import { isRequestEntityTooLargeError, isUnsupportedMediaTypeError } from 'ghost-admin/services/ajax'; -import {computed} from '@ember/object'; import {isBlank} from '@ember/utils'; import {isArray as isEmberArray} from '@ember/array'; import {run} from '@ember/runloop'; @@ -63,25 +62,6 @@ export default Controller.extend({ this.yamlMimeType = YAML_MIME_TYPE; }, - subscriptionSettings: computed('settings.membersSubscriptionSettings', function () { - let subscriptionSettings = this.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings')); - let stripeProcessor = subscriptionSettings.paymentProcessors.find((proc) => { - return (proc.adapter === 'stripe'); - }); - let monthlyPlan = stripeProcessor.config.plans.find(plan => plan.interval === 'month'); - let yearlyPlan = stripeProcessor.config.plans.find(plan => plan.interval === 'year'); - monthlyPlan.dollarAmount = parseInt(monthlyPlan.amount) ? (monthlyPlan.amount / 100) : 0; - yearlyPlan.dollarAmount = parseInt(yearlyPlan.amount) ? (yearlyPlan.amount / 100) : 0; - stripeProcessor.config.plans = { - monthly: monthlyPlan, - yearly: yearlyPlan - }; - subscriptionSettings.stripeConfig = stripeProcessor.config; - subscriptionSettings.requirePaymentForSetup = !!subscriptionSettings.requirePaymentForSetup; - subscriptionSettings.fromAddress = subscriptionSettings.fromAddress || 'noreply'; - return subscriptionSettings; - }), - actions: { onUpload(file) { let formData = new FormData(); diff --git a/app/templates/components/gh-members-lab-setting.hbs b/app/templates/components/gh-members-lab-setting.hbs index 643e28865..a19a4a0b0 100644 --- a/app/templates/components/gh-members-lab-setting.hbs +++ b/app/templates/components/gh-members-lab-setting.hbs @@ -83,11 +83,11 @@
-
diff --git a/mirage/fixtures/settings.js b/mirage/fixtures/settings.js index 6d8379221..5e2400165 100644 --- a/mirage/fixtures/settings.js +++ b/mirage/fixtures/settings.js @@ -177,7 +177,7 @@ export default [ id: 23, type: 'members', key: 'members_subscription_settings', - value: '{"isPaid":false,"requirePaymentForSignup":false,"fromAddress":"noreply","paymentProcessors":[{"adapter":"stripe","config":{"secret_token":"","public_token":"","product":{"name":"Ghost Subscription"},"plans":[{"name":"Monthly","currency":"usd","interval":"month","amount":""},{"name":"Yearly","currency":"usd","interval":"year","amount":""}]}}]}', + value: '{"isPaid":false,"allowSelfSignup":true,"fromAddress":"noreply","paymentProcessors":[{"adapter":"stripe","config":{"secret_token":"","public_token":"","product":{"name":"Ghost Subscription"},"plans":[{"name":"Monthly","currency":"usd","interval":"month","amount":""},{"name":"Yearly","currency":"usd","interval":"year","amount":""}]}}]}', created_at: '2019-10-09T09:49:00.000Z', created_by: 1, updated_at: '2019-10-09T09:49:00.000Z',