From ea7d450a9b69d53ff99a6110e8e5dce668ec2134 Mon Sep 17 00:00:00 2001 From: Rishabh Garg Date: Thu, 18 Jun 2020 17:11:08 +0530 Subject: [PATCH] Added new settings for members modal settings (#11927) no issue - Adds new settings for members modal customization to default settings - `membersjs_show_beacon` controls the visibility of beacon in members modal - `membersjs_show_signup_name` controls the visibility of name field in signup - `membersjs_allowed_plans` controls the visibility of plans allowed for member to signup with - Adds stripe connect check to determine if stripe is setup or not - Adds the 3 new settings to members site data --- core/server/data/schema/default-settings.json | 17 +++++++++++++++++ core/server/services/members/middleware.js | 9 +++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/core/server/data/schema/default-settings.json b/core/server/data/schema/default-settings.json index e29f90ab37..15230a6973 100644 --- a/core/server/data/schema/default-settings.json +++ b/core/server/data/schema/default-settings.json @@ -220,6 +220,23 @@ }, "stripe_connect_integration": { "defaultValue": "{}" + }, + "membersjs_show_signup_name": { + "defaultValue": "true", + "validations": { + "isEmpty": false, + "isIn": [["true", "false"]] + } + }, + "membersjs_show_beacon": { + "defaultValue": "true", + "validations": { + "isEmpty": false, + "isIn": [["true", "false"]] + } + }, + "membersjs_allowed_plans": { + "defaultValue": "[\"free\", \"monthly\", \"yearly\"]" } }, "bulk_email": { diff --git a/core/server/services/members/middleware.js b/core/server/services/members/middleware.js index 04dd945db5..ae88838acc 100644 --- a/core/server/services/members/middleware.js +++ b/core/server/services/members/middleware.js @@ -89,7 +89,9 @@ const getMemberSiteData = async function (req, res) { ); const stripeSecretToken = stripePaymentProcessor && stripePaymentProcessor.config.secret_token; const stripePublicToken = stripePaymentProcessor && stripePaymentProcessor.config.public_token; - const isStripeConfigured = (!!stripeSecretToken && stripeSecretToken !== '' && !!stripePublicToken && stripePublicToken !== ''); + const stripeConnectIntegration = settingsCache.get('stripe_connect_integration'); + + const isStripeConfigured = (!!stripeSecretToken && !!stripePublicToken) || !!(stripeConnectIntegration && stripeConnectIntegration.account_id); const response = { title: settingsCache.get('title'), description: settingsCache.get('description'), @@ -99,7 +101,10 @@ const getMemberSiteData = async function (req, res) { version: ghostVersion.safe, plans: membersService.config.getPublicPlans(), allowSelfSignup: membersService.config.getAllowSelfSignup(), - isStripeConfigured + isStripeConfigured, + show_beacon: settingsCache.get('membersjs_show_beacon'), + show_signup_name: settingsCache.get('membersjs_show_signup_name'), + allowed_plans: settingsCache.get('membersjs_allowed_plans') }; // Brand is currently an experimental feature