From 49abeaf398efe1c368933f95703243d430ac0b1d Mon Sep 17 00:00:00 2001 From: Rish Date: Thu, 17 Sep 2020 12:32:53 +0530 Subject: [PATCH] Added blog domain for default support address no issue - Members site data was not appending blog domain for default support address which is `noreply` - The change allows Portal to use default support address correctly --- core/server/services/members/middleware.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/server/services/members/middleware.js b/core/server/services/members/middleware.js index f477856e56..7e7d555553 100644 --- a/core/server/services/members/middleware.js +++ b/core/server/services/members/middleware.js @@ -90,7 +90,12 @@ const updateMemberData = async function (req, res) { const getMemberSiteData = async function (req, res) { const isStripeConfigured = membersService.config.isStripeConnected(); - + const domain = urlUtils.urlFor('home', true).match(new RegExp('^https?://([^/:?#]+)(?:[/:?#]|$)', 'i')); + const blogDomain = domain && domain[1]; + let supportAddress = settingsCache.get('members_support_address'); + if (!supportAddress.includes('@')) { + supportAddress = `${supportAddress}@${blogDomain}`; + } const response = { title: settingsCache.get('title'), description: settingsCache.get('description'), @@ -108,7 +113,7 @@ const getMemberSiteData = async function (req, res) { portal_button_icon: settingsCache.get('portal_button_icon'), portal_button_signup_text: settingsCache.get('portal_button_signup_text'), portal_button_style: settingsCache.get('portal_button_style'), - members_support_address: settingsCache.get('members_support_address') + members_support_address: supportAddress }; // accent_color is currently an experimental feature