mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 09:22:49 +03:00
df82895db7
issue #5976 - break out the labs check into a utility - wrap the get helper in a labs check, so it only works if the checkbox is checked - make the get helper output an error to both the server and browser console if used when not enabled
21 lines
524 B
JavaScript
21 lines
524 B
JavaScript
var _ = require('lodash'),
|
|
api = require('../api'),
|
|
flagIsSet;
|
|
|
|
flagIsSet = function flagIsSet(flag) {
|
|
return api.settings.read({key: 'labs', context: {internal: true}}).then(function (response) {
|
|
var labs,
|
|
labsValue;
|
|
|
|
labs = _.find(response.settings, function (setting) {
|
|
return setting.key === 'labs';
|
|
});
|
|
|
|
labsValue = JSON.parse(labs.value);
|
|
|
|
return !!labsValue[flag] && labsValue[flag] === true;
|
|
});
|
|
};
|
|
|
|
module.exports.isSet = flagIsSet;
|