mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-15 03:01:37 -05:00
Updated members setting serializer for mail config
This commit is contained in:
parent
bb223f9f4d
commit
78a9463243
2 changed files with 23 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
const _ = require('lodash');
|
||||
const localUtils = require('../../../index');
|
||||
const config = require('../../../../../../config');
|
||||
|
||||
const tag = (attrs, frame) => {
|
||||
if (localUtils.isContentAPI(frame)) {
|
||||
|
@ -138,7 +139,28 @@ const action = (attrs) => {
|
|||
}
|
||||
};
|
||||
|
||||
const settings = (attrs, frame) => {
|
||||
// @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}) => {
|
||||
return key === 'members_subscription_settings';
|
||||
}).value;
|
||||
if (config.get('mailgunApiKey')) {
|
||||
let membersSubscriptionSettingsJson = JSON.parse(membersSubscriptionSettings);
|
||||
delete membersSubscriptionSettingsJson.mailgunApiKey;
|
||||
attrs.forEach((attr) => {
|
||||
if (attr.key === 'members_subscription_settings') {
|
||||
attr.value = JSON.stringify(membersSubscriptionSettingsJson);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.post = post;
|
||||
module.exports.tag = tag;
|
||||
module.exports.author = author;
|
||||
module.exports.action = action;
|
||||
module.exports.settings = settings;
|
||||
|
|
|
@ -78,6 +78,7 @@ const mapPost = (model, frame) => {
|
|||
const mapSettings = (attrs, frame) => {
|
||||
url.forSettings(attrs);
|
||||
extraAttrs.forSettings(attrs, frame);
|
||||
clean.settings(attrs, frame);
|
||||
|
||||
// NOTE: The cleanup of deprecated ghost_head/ghost_foot has to happen here
|
||||
// because codeinjection_head/codeinjection_foot are assigned on a previous
|
||||
|
|
Loading…
Add table
Reference in a new issue