0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Added labs safeguard for announcementBar settings

refs https://github.com/TryGhost/Team/issues/3051

- An extra safeguard to prevent announcementBar feature variables from accidentally leaking through the Content API.
This commit is contained in:
Naz 2023-04-21 16:40:37 +02:00
parent 22c45ee9b1
commit f9fbac8fa5
No known key found for this signature in database

View file

@ -2,6 +2,7 @@ const settingsCache = require('../../../shared/settings-cache');
const urlUtils = require('../../../shared/url-utils');
const ghostVersion = require('@tryghost/version');
const announcementBarSettings = require('../../services/announcement-bar-service');
const labs = require('../../../shared/labs');
module.exports = {
docName: 'settings',
@ -9,7 +10,10 @@ module.exports = {
browse: {
permissions: true,
query(frame) {
const announcementSettings = announcementBarSettings.getAnnouncementSettings(frame.options.context?.member);
let announcementSettings;
if (labs.isSet('announcementBar')) {
announcementSettings = announcementBarSettings.getAnnouncementSettings(frame.options.context?.member);
}
// @TODO: decouple settings cache from API knowledge
// The controller fetches models (or cached models) and the API frame for the target API version formats the response.