0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-15 03:01:37 -05:00

Merge master -> v3 (#11242)

Merge master -> v3
This commit is contained in:
Fabien O'Carroll 2019-10-15 17:44:14 +07:00 committed by GitHub
commit c9c37b0da2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 87 additions and 20 deletions

View file

@ -19,7 +19,7 @@
<a href="https://twitter.com/ghost">Twitter</a>
<br /><br />
<a href="https://ghost.org">
<img src="https://img.shields.io/badge/downloads-1.4M-brightgreen.svg" alt="Downloads" />
<img src="https://img.shields.io/badge/downloads-2M-brightgreen.svg" alt="Downloads" />
</a>
<a href="https://github.com/TryGhost/Ghost/releases/">
<img src="https://img.shields.io/github/release/TryGhost/Ghost.svg" alt="Latest release" />

@ -1 +1 @@
Subproject commit 2c661efe419bfb7a2d29fdc1015fd064eadcc4ed
Subproject commit 897ea66a0070154d1f215cb23aa545b8030b3913

View file

@ -0,0 +1,67 @@
const _ = require('lodash');
const Promise = require('bluebird');
const common = require('../../../../lib/common');
module.exports.config = {
transaction: true
};
module.exports.up = (options) => {
let localOptions = _.merge({
context: {internal: true}
}, options);
const settingsKey = 'members_subscription_settings';
return localOptions
.transacting('settings')
.then((response) => {
if (!response) {
common.logging.warn('Cannot find settings.');
return;
}
let subscriptionSettingsEntry = response.find((entry) => {
return entry.key === settingsKey;
});
if (!subscriptionSettingsEntry) {
common.logging.warn('Cannot find members subscription settings.');
return;
}
let subscriptionSettings = JSON.parse(subscriptionSettingsEntry.value);
let hasRequirePaymentProperty = Object.prototype.hasOwnProperty.call(subscriptionSettings, 'requirePaymentForSignup');
let hasSelfSignupProperty = Object.prototype.hasOwnProperty.call(subscriptionSettings, 'allowSelfSignup');
let hasFromAddressProperty = Object.prototype.hasOwnProperty.call(subscriptionSettings, 'fromAddress');
if (!hasFromAddressProperty) {
subscriptionSettings.fromAddress = 'noreply';
}
if (!hasRequirePaymentProperty && !hasSelfSignupProperty) {
subscriptionSettings.allowSelfSignup = true;
}
if (hasRequirePaymentProperty) {
if (!hasSelfSignupProperty) {
common.logging.info(`Adding allowSelfSignup property from requirePaymentForSignup in member settings`);
subscriptionSettings.allowSelfSignup = !subscriptionSettings.requirePaymentForSignup;
}
common.logging.info(`Removing requirePaymentForSignup property in member settings`);
delete subscriptionSettings.requirePaymentForSignup;
}
return localOptions
.transacting('settings')
.where('key', settingsKey)
.update({
value: JSON.stringify(subscriptionSettings)
});
});
};
// `up` only runs in order to normalize member subscription settings which was added
// no need for down migration as its non-breaking up migration for future versions only
module.exports.down = () => Promise.resolve();
module.exports.config = {
transaction: true
};

View file

@ -262,7 +262,7 @@ describe('Settings API (v2)', function () {
});
});
it.skip('cannot toggle member setting', function (done) {
it('cannot toggle member setting', function (done) {
const settingToChange = {
settings: [
{

View file

@ -1,6 +1,6 @@
{
"name": "ghost",
"version": "2.36.0",
"version": "2.37.0",
"description": "The professional publishing platform",
"author": "Ghost Foundation",
"homepage": "https://ghost.org",
@ -42,10 +42,10 @@
"@nexes/nql": "0.3.0",
"@tryghost/helpers": "1.1.15",
"@tryghost/members-api": "0.8.2",
"@tryghost/members-ssr": "0.7.0",
"@tryghost/social-urls": "0.1.2",
"@tryghost/members-ssr": "0.7.1",
"@tryghost/social-urls": "0.1.3",
"@tryghost/string": "^0.1.3",
"@tryghost/url-utils": "0.6.9",
"@tryghost/url-utils": "0.6.10",
"ajv": "6.10.2",
"amperize": "0.6.0",
"analytics-node": "3.3.0",

View file

@ -253,10 +253,10 @@
node-jose "^1.1.3"
stripe "^7.4.0"
"@tryghost/members-ssr@0.7.0":
version "0.7.0"
resolved "https://registry.yarnpkg.com/@tryghost/members-ssr/-/members-ssr-0.7.0.tgz#d4e7a6554375b65efc13651361311f0c960f9cd9"
integrity sha512-DE4xXjIvJBL/JG9wj/6tVajDgbGJ0Qvq4LjNW9gjO2EmeG6W7F9RKPyy4H4hDnSv+g5LG1oz6c/aIkivaQjNOw==
"@tryghost/members-ssr@0.7.1":
version "0.7.1"
resolved "https://registry.yarnpkg.com/@tryghost/members-ssr/-/members-ssr-0.7.1.tgz#e4d5e17478af44b5e3de6bf05e4a282fade0db8a"
integrity sha512-akwMXRF9yj+QMxpRkbDfN0w5/+lBm02TU1Qme4eAdtcdu4WHOJEao/w4cRTaqaVivmZBWowbvBCaSEGjv96dQg==
dependencies:
bluebird "^3.5.3"
concat-stream "^2.0.0"
@ -281,12 +281,12 @@
chalk "^2.4.1"
sywac "^1.2.1"
"@tryghost/social-urls@0.1.2":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@tryghost/social-urls/-/social-urls-0.1.2.tgz#3ebccae37230cbc2fcec98b57b790d416474a7b7"
integrity sha512-4BHdVkRHhhvici6xanXETJQKyR7R1ONtK681RhMm09+xDgG0WJ2igqUsI8xjlTYnNudOX28UYfN1S6zRmcmzGA==
"@tryghost/social-urls@0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@tryghost/social-urls/-/social-urls-0.1.3.tgz#3de95811b5d9de3dfb28bf9241a36d5cb9f33a52"
integrity sha512-/sO7MXtcb/qhYkul4CRx9iP1dEVQpCEf4F/mjPzPEEs8DVabPoOke3dlwYuJI9XJcuLab9E/j/tVE1C4R8VodQ==
dependencies:
bluebird "3.5.5"
bluebird "3.7.0"
ghost-ignition "3.1.0"
lodash "4.17.11"
@ -297,10 +297,10 @@
dependencies:
unidecode "^0.1.8"
"@tryghost/url-utils@0.6.9":
version "0.6.9"
resolved "https://registry.yarnpkg.com/@tryghost/url-utils/-/url-utils-0.6.9.tgz#4281988f5f53eab9446b553eac914d7777aa0d64"
integrity sha512-47nmkJ2NHOpCDdjmgSwBwiaZuSQvfcOQCf1lcbkNf38VEbaNW9cEWFAcjOOVkrDpaz38vYgfdv5lihNwhwO4Dw==
"@tryghost/url-utils@0.6.10":
version "0.6.10"
resolved "https://registry.yarnpkg.com/@tryghost/url-utils/-/url-utils-0.6.10.tgz#8ab8cf4e4717b24835c5c9ea58a515cdb3b742e5"
integrity sha512-VHQh3QluR/46CNhIvF6E7GQvfh8UoOQZa4NeNlfrJILadrZQ1Cst8mnSyXIcNq/KBC8ULGDVlbYjfQVgrLeRPg==
dependencies:
cheerio "0.22.0"
moment "2.24.0"