mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Added mailgun domain to members subscription settings
no issue - Delete api key and domain setting if its in the config to hide it in admin
This commit is contained in:
parent
86d6fc8578
commit
97e2af9a06
3 changed files with 10 additions and 2 deletions
|
@ -140,7 +140,6 @@ 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
|
||||
if (_.isArray(attrs)) {
|
||||
const membersSubscriptionSettingsObj = attrs.find(({key}) => {
|
||||
|
@ -150,6 +149,7 @@ const settings = (attrs) => {
|
|||
if (membersSubscriptionSettings && config.get('mailgunApiKey')) {
|
||||
let membersSubscriptionSettingsJson = JSON.parse(membersSubscriptionSettings);
|
||||
delete membersSubscriptionSettingsJson.mailgunApiKey;
|
||||
delete membersSubscriptionSettingsJson.mailgunDomain;
|
||||
attrs.forEach((attr) => {
|
||||
if (attr.key === 'members_subscription_settings') {
|
||||
attr.value = JSON.stringify(membersSubscriptionSettingsJson);
|
||||
|
|
|
@ -29,6 +29,7 @@ module.exports.up = (options) => {
|
|||
let subscriptionSettings = JSON.parse(subscriptionSettingsEntry.value);
|
||||
|
||||
let hasMailgunApiKeyProperty = Object.prototype.hasOwnProperty.call(subscriptionSettings, 'mailgunApiKey');
|
||||
let hasMailgunDomainProperty = Object.prototype.hasOwnProperty.call(subscriptionSettings, 'mailgunDomain');
|
||||
|
||||
if (!hasMailgunApiKeyProperty) {
|
||||
subscriptionSettings.mailgunApiKey = '';
|
||||
|
@ -37,6 +38,13 @@ module.exports.up = (options) => {
|
|||
common.logging.warn('Mail provider API key setting already exists in members settings.');
|
||||
}
|
||||
|
||||
if (!hasMailgunDomainProperty) {
|
||||
subscriptionSettings.mailgunDomain = '';
|
||||
common.logging.info('Adding mailgun domain to members settings');
|
||||
} else {
|
||||
common.logging.warn('Mailgun domain setting already exists in members settings.');
|
||||
}
|
||||
|
||||
return localOptions
|
||||
.transacting('settings')
|
||||
.where('key', settingsKey)
|
|
@ -201,7 +201,7 @@
|
|||
"defaultValue": "public"
|
||||
},
|
||||
"members_subscription_settings": {
|
||||
"defaultValue": "{\"mailgunApiKey\": \"\",\"isPaid\":false,\"fromAddress\":\"noreply\",\"allowSelfSignup\":true,\"paymentProcessors\":[{\"adapter\":\"stripe\",\"config\":{\"secret_token\":\"\",\"public_token\":\"\",\"product\":{\"name\":\"Ghost Subscription\"},\"plans\":[{\"name\":\"Monthly\",\"currency\":\"usd\",\"interval\":\"month\",\"amount\":\"\"},{\"name\":\"Yearly\",\"currency\":\"usd\",\"interval\":\"year\",\"amount\":\"\"}]}}]}"
|
||||
"defaultValue": "{\"mailgunApiKey\": \"\",\"mailgunDomain\": \"\",\"isPaid\":false,\"fromAddress\":\"noreply\",\"allowSelfSignup\":true,\"paymentProcessors\":[{\"adapter\":\"stripe\",\"config\":{\"secret_token\":\"\",\"public_token\":\"\",\"product\":{\"name\":\"Ghost Subscription\"},\"plans\":[{\"name\":\"Monthly\",\"currency\":\"usd\",\"interval\":\"month\",\"amount\":\"\"},{\"name\":\"Yearly\",\"currency\":\"usd\",\"interval\":\"year\",\"amount\":\"\"}]}}]}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue