Fixed members settings cleanup for mailgun config

This commit is contained in:
Rish 2019-11-06 15:21:33 +07:00
parent b3aba084ee
commit 45cd39c386

View File

@ -142,12 +142,12 @@ const action = (attrs) => {
const settings = (attrs) => {
// @NOTE: Admin & Content API return a different format, need to mappers
// We don't send mail provider API key in settings API if set in config
let membersSubscriptionSettings = {};
if (_.isArray(attrs)) {
membersSubscriptionSettings = attrs.find(({key}) => {
const membersSubscriptionSettingsObj = attrs.find(({key}) => {
return key === 'members_subscription_settings';
}).value;
if (config.get('mailgunApiKey')) {
}) || {};
const membersSubscriptionSettings = membersSubscriptionSettingsObj.value;
if (membersSubscriptionSettings && config.get('mailgunApiKey')) {
let membersSubscriptionSettingsJson = JSON.parse(membersSubscriptionSettings);
delete membersSubscriptionSettingsJson.mailgunApiKey;
attrs.forEach((attr) => {