Added default support address for member site data

no issue

- In a case where support address is null, member's site data won't load as there was no fallback.
- The fix adds default `noreply` as the support address for site data
This commit is contained in:
Rish 2020-10-15 14:44:03 +05:30
parent a9b3d83e00
commit 54e638310c

View File

@ -91,7 +91,7 @@ const getMemberSiteData = async function (req, res) {
const isStripeConfigured = membersService.config.isStripeConnected(); const isStripeConfigured = membersService.config.isStripeConnected();
const domain = urlUtils.urlFor('home', true).match(new RegExp('^https?://([^/:?#]+)(?:[/:?#]|$)', 'i')); const domain = urlUtils.urlFor('home', true).match(new RegExp('^https?://([^/:?#]+)(?:[/:?#]|$)', 'i'));
const blogDomain = domain && domain[1]; const blogDomain = domain && domain[1];
let supportAddress = settingsCache.get('members_support_address'); let supportAddress = settingsCache.get('members_support_address') || 'noreply';
if (!supportAddress.includes('@')) { if (!supportAddress.includes('@')) {
supportAddress = `${supportAddress}@${blogDomain}`; supportAddress = `${supportAddress}@${blogDomain}`;
} }