Updated host config to correctly use camelCase

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

- When the host config was introduced it was incorrectly introduced as host_settings instead of hostSettings
- All other Ghost config uses camelCase, so changing this now before it becomes a problem
- Note: Also removed some rogue return awaits that don't make sense. It's not possible to hit that case, but cleaning up anyway
This commit is contained in:
Hannah Wolfe 2021-03-04 11:34:11 +00:00
parent 84e5bdc46a
commit 26f56626ce
7 changed files with 17 additions and 17 deletions

View File

@ -9,7 +9,7 @@ module.exports = {
read: {
permissions: false,
query() {
const billingUrl = config.get('host_settings:billing:enabled') ? config.get('host_settings:billing:url') : '';
const billingUrl = config.get('hostSettings:billing:enabled') ? config.get('hostSettings:billing:url') : '';
const response = {
version: ghostVersion.full,
environment: config.get('env'),

View File

@ -76,8 +76,8 @@ module.exports = {
if (frame.options.source === 'github') {
const [org, repo] = frame.options.ref.toLowerCase().split('/');
if (limitService.isLimited('custom_themes') && org.toLowerCase() !== 'tryghost') {
await limitService.errorIfWouldGoOverLimit('custom_themes');
if (limitService.isLimited('customThemes') && org.toLowerCase() !== 'tryghost') {
await limitService.errorIfWouldGoOverLimit('customThemes');
}
// omit /:ref so we fetch the default branch
@ -139,8 +139,8 @@ module.exports = {
method: 'add'
},
async query(frame) {
if (limitService.isLimited('custom_themes')) {
return await limitService.errorIfWouldGoOverLimit('custom_themes');
if (limitService.isLimited('customThemes')) {
await limitService.errorIfWouldGoOverLimit('customThemes');
}
// @NOTE: consistent filename uploads

View File

@ -53,8 +53,8 @@ module.exports = {
method: 'add'
},
async query(frame) {
if (limitService.isLimited('custom_themes')) {
return await limitService.errorIfWouldGoOverLimit('custom_themes');
if (limitService.isLimited('customThemes')) {
await limitService.errorIfWouldGoOverLimit('customThemes');
}
// @NOTE: consistent filename uploads

View File

@ -53,8 +53,8 @@ module.exports = {
method: 'add'
},
async query(frame) {
if (limitService.isLimited('custom_themes')) {
return await limitService.errorIfWouldGoOverLimit('custom_themes');
if (limitService.isLimited('customThemes')) {
await limitService.errorIfWouldGoOverLimit('customThemes');
}
// @NOTE: consistent filename uploads

View File

@ -66,10 +66,10 @@ const Integration = ghostBookshelf.Model.extend({
async permissible(integrationModel, action) {
const isAdd = (action === 'add');
if (isAdd && limitService.isLimited('custom_integrations')) {
if (isAdd && limitService.isLimited('customIntegrations')) {
// CASE: if your site is limited to a certain number of custom integrations
// Inviting a new custom integration requires we check we won't go over the limit
await limitService.errorIfWouldGoOverLimit('custom_integrations');
await limitService.errorIfWouldGoOverLimit('customIntegrations');
}
return true;
}

View File

@ -6,17 +6,17 @@ let limitService = new LimitService();
const initFn = () => {
let helpLink;
if (!config.get('host_settings') || !config.get('host_settings:limits')) {
if (!config.get('hostSettings') || !config.get('hostSettings:limits')) {
return;
}
if (config.get('host_settings:billing:enabled') && config.get('host_settings:billing:enabled') === true && config.get('host_settings:billing:url')) {
helpLink = config.get('host_settings:billing:url');
if (config.get('hostSettings:billing:enabled') && config.get('hostSettings:billing:enabled') === true && config.get('hostSettings:billing:url')) {
helpLink = config.get('hostSettings:billing:url');
} else {
helpLink = 'https://ghost.org/help/';
}
limitService.loadLimits({limits: config.get('host_settings:limits'), db, helpLink});
limitService.loadLimits({limits: config.get('hostSettings:limits'), db, helpLink});
};
module.exports = limitService;

View File

@ -8,10 +8,10 @@ async function getTotalMembers() {
}
module.exports = async () => {
const membersHostLimit = config.get('host_settings:limits:members');
const membersHostLimit = config.get('hostSettings:limits:members');
if (membersHostLimit) {
const allowedMembersLimit = membersHostLimit.max;
const hostUpgradeLink = config.get('host_settings:limits').upgrade_url;
const hostUpgradeLink = config.get('hostSettings:limits').upgrade_url;
const totalMembers = await getTotalMembers();