mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Updated syntax in labs service
- use consistent, simpler syntax
This commit is contained in:
parent
7a36200e24
commit
ca61e245e8
1 changed files with 5 additions and 7 deletions
|
@ -5,9 +5,7 @@ const SafeString = require('../../frontend/services/themes/engine').SafeString;
|
|||
const common = require('../lib/common');
|
||||
const deprecatedFeatures = ['subscribers', 'publicAPI'];
|
||||
|
||||
let labs = module.exports = {};
|
||||
|
||||
labs.getAll = () => {
|
||||
module.exports.getAll = () => {
|
||||
let labs = _.cloneDeep(settingsCache.get('labs')) || {};
|
||||
// Remove old labs flags that should always be false now
|
||||
deprecatedFeatures.forEach((feature) => {
|
||||
|
@ -17,17 +15,17 @@ labs.getAll = () => {
|
|||
return labs;
|
||||
};
|
||||
|
||||
labs.isSet = function isSet(flag) {
|
||||
var labsConfig = labs.getAll();
|
||||
module.exports.isSet = function isSet(flag) {
|
||||
const labsConfig = module.exports.getAll();
|
||||
|
||||
return !!(labsConfig && labsConfig[flag] && labsConfig[flag] === true);
|
||||
};
|
||||
|
||||
labs.enabledHelper = function enabledHelper(options, callback) {
|
||||
module.exports.enabledHelper = function enabledHelper(options, callback) {
|
||||
const errDetails = {};
|
||||
let errString;
|
||||
|
||||
if (labs.isSet(options.flagKey) === true) {
|
||||
if (module.exports.isSet(options.flagKey) === true) {
|
||||
// helper is active, use the callback
|
||||
return callback();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue