mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-09-23 02:49:03 +03:00
✨ Promoted email-only feature to general availability
closes https://github.com/TryGhost/Team/issues/1125
refs 3c822e0457
- Email-only is not considered a general availability feature and can be used without special flags.
- It allows to publish a new post type "email only" that only goes out as an email newletter and is available through an undescoverable URL (does not appear anywhere publicly similarly to preview posts) on the site.
This commit is contained in:
parent
e8ad189511
commit
c65e62b7df
@ -3,7 +3,6 @@ const config = require('../../../../shared/config');
|
||||
const urlService = require('../../url');
|
||||
const urlUtils = require('../../../../shared/url-utils');
|
||||
const helpers = require('../helpers');
|
||||
const labs = require('../../../../shared/labs');
|
||||
|
||||
/**
|
||||
* @description Email Post Controller.
|
||||
@ -12,7 +11,7 @@ const labs = require('../../../../shared/labs');
|
||||
* @param {Function} next
|
||||
* @returns {Promise}
|
||||
*/
|
||||
module.exports = [labs.enabledMiddleware('emailOnlyPosts'), function emailPostController(req, res, next) {
|
||||
module.exports = function emailPostController(req, res, next) {
|
||||
debug('emailPostController');
|
||||
|
||||
const api = require('../../proxy').api[res.locals.apiVersion];
|
||||
@ -63,4 +62,4 @@ module.exports = [labs.enabledMiddleware('emailOnlyPosts'), function emailPostCo
|
||||
return renderer(post);
|
||||
})
|
||||
.catch(helpers.handleError(next));
|
||||
}];
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
const urlService = require('../../../../../../../frontend/services/url');
|
||||
const urlUtils = require('../../../../../../../shared/url-utils');
|
||||
const labs = require('../../../../../../../shared/labs');
|
||||
const localUtils = require('../../../index');
|
||||
|
||||
const forPost = (id, attrs, frame) => {
|
||||
@ -24,7 +23,7 @@ const forPost = (id, attrs, frame) => {
|
||||
*/
|
||||
if (!localUtils.isContentAPI(frame)) {
|
||||
if (attrs.status !== 'published' && attrs.url.match(/\/404\//)) {
|
||||
if (labs.isSet('emailOnlyPosts') && attrs.posts_meta && attrs.posts_meta.email_only) {
|
||||
if (attrs.posts_meta && attrs.posts_meta.email_only) {
|
||||
attrs.url = urlUtils.urlFor({
|
||||
relativeUrl: urlUtils.urlJoin('/email', attrs.uuid, '/')
|
||||
}, null, true);
|
||||
|
@ -24,7 +24,6 @@ const BETA_FEATURES = [
|
||||
|
||||
const ALPHA_FEATURES = [
|
||||
'oauthLogin',
|
||||
'emailOnlyPosts',
|
||||
'customThemeSettings',
|
||||
'membersActivity',
|
||||
'offers'
|
||||
|
@ -9,7 +9,6 @@ const cheerio = require('cheerio');
|
||||
|
||||
const testUtils = require('../../utils');
|
||||
const config = require('../../../core/shared/config');
|
||||
const settingsCache = require('../../../core/shared/settings-cache');
|
||||
const bridge = require('../../../core/bridge');
|
||||
|
||||
describe('Frontend Routing: Email Routes', function () {
|
||||
@ -19,18 +18,6 @@ describe('Frontend Routing: Email Routes', function () {
|
||||
before(async function () {
|
||||
sinon.stub(bridge, 'getFrontendApiVersion')
|
||||
.returns('v4');
|
||||
const originalSettingsCacheGetFn = settingsCache.get;
|
||||
|
||||
// NOTE: this wacky stubbing can be removed once emailOnlyPosts enters GA stage
|
||||
sinon.stub(settingsCache, 'get').callsFake(function (key, options) {
|
||||
if (key === 'labs') {
|
||||
return {
|
||||
emailOnlyPosts: true
|
||||
};
|
||||
}
|
||||
|
||||
return originalSettingsCacheGetFn(key, options);
|
||||
});
|
||||
|
||||
await testUtils.startGhost();
|
||||
|
||||
|
@ -22,16 +22,18 @@ describe('Labs Service', function () {
|
||||
sinon.stub(process.env, 'NODE_ENV').value('production');
|
||||
sinon.stub(settingsCache, 'get');
|
||||
settingsCache.get.withArgs('labs').returns({
|
||||
emailOnlyPosts: true
|
||||
oauthLogin: true
|
||||
});
|
||||
|
||||
// NOTE: this test should be rewritten to test the alpha flag independently of the internal ALPHA_FEATURES list
|
||||
// otherwise we end up in the endless maintenance loop and need to update it every time a feature graduates from alpha
|
||||
labs.getAll().should.eql({
|
||||
emailOnlyPosts: true,
|
||||
oauthLogin: true,
|
||||
members: true
|
||||
});
|
||||
|
||||
labs.isSet('members').should.be.true;
|
||||
labs.isSet('emailOnlyPosts').should.be.true;
|
||||
labs.isSet('oauthLogin').should.be.true;
|
||||
});
|
||||
|
||||
it('returns a falsy alpha flag when dev experiments in NOT toggled', function () {
|
||||
@ -39,15 +41,17 @@ describe('Labs Service', function () {
|
||||
sinon.stub(process.env, 'NODE_ENV').value('production');
|
||||
sinon.stub(settingsCache, 'get');
|
||||
settingsCache.get.withArgs('labs').returns({
|
||||
emailOnlyPosts: true
|
||||
oauthLogin: true
|
||||
});
|
||||
|
||||
// NOTE: this test should be rewritten to test the alpha flag independently of the internal ALPHA_FEATURES list
|
||||
// otherwise we end up in the endless maintenance loop and need to update it every time a feature graduates from alpha
|
||||
labs.getAll().should.eql({
|
||||
members: true
|
||||
});
|
||||
|
||||
labs.isSet('members').should.be.true;
|
||||
labs.isSet('emailOnlyPosts').should.be.false;
|
||||
labs.isSet('oauthLogin').should.be.false;
|
||||
});
|
||||
|
||||
it('members flag is true when members_signup_access setting is "all"', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user