0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Removed use of proxy in theme service

refs: bf0823c9a2

- continuing the work of splitting up the theme service into logical components
- am about to move the theme service to core/server so it should require i18n directly
This commit is contained in:
Hannah Wolfe 2021-04-27 13:22:26 +01:00
parent 53669b6e71
commit b128cebcb0
3 changed files with 7 additions and 7 deletions

View file

@ -1,6 +1,6 @@
const _ = require('lodash');
const debug = require('ghost-ignition').debug('themes');
const {i18n: commonI18n} = require('../proxy');
const {i18n} = require('../../../server/lib/common');
const logging = require('../../../shared/logging');
const errors = require('@tryghost/errors');
const themeLoader = require('./loader');
@ -26,7 +26,7 @@ module.exports = {
.then(function validationSuccess(checkedTheme) {
if (!validate.canActivate(checkedTheme)) {
const checkError = new errors.ThemeValidationError({
message: commonI18n.t('errors.middleware.themehandler.invalidTheme', {theme: activeThemeName}),
message: i18n.t('errors.middleware.themehandler.invalidTheme', {theme: activeThemeName}),
errorDetails: Object.assign(
_.pick(checkedTheme, ['checkedVersion', 'name', 'path', 'version']), {
errors: checkedTheme.results.error
@ -42,7 +42,7 @@ module.exports = {
if (checkedTheme.results.error.length) {
logging.warn(new errors.ThemeValidationError({
errorType: 'ThemeWorksButHasErrors',
message: commonI18n.t('errors.middleware.themehandler.themeHasErrors', {theme: activeThemeName}),
message: i18n.t('errors.middleware.themehandler.themeHasErrors', {theme: activeThemeName}),
errorDetails: Object.assign(
_.pick(checkedTheme, ['checkedVersion', 'name', 'path', 'version']), {
errors: checkedTheme.results.error
@ -59,7 +59,7 @@ module.exports = {
})
.catch(errors.NotFoundError, function (err) {
// CASE: active theme is missing, we don't want to exit because the admin panel will still work
err.message = commonI18n.t('errors.middleware.themehandler.missingTheme', {theme: activeThemeName});
err.message = i18n.t('errors.middleware.themehandler.missingTheme', {theme: activeThemeName});
logging.error(err);
})
.catch(function (err) {
@ -74,7 +74,7 @@ module.exports = {
if (!loadedTheme) {
return Promise.reject(new errors.ValidationError({
message: commonI18n.t('notices.data.validation.index.themeCannotBeActivated', {themeName: themeName}),
message: i18n.t('notices.data.validation.index.themeCannotBeActivated', {themeName: themeName}),
errorDetails: themeName
}));
}

View file

@ -8,7 +8,7 @@ const themeLoader = require('./loader');
const toJSON = require('./to-json');
const settingsCache = require('../../../server/services/settings/cache');
const {i18n} = require('../proxy');
const {i18n} = require('../../../server/lib/common');
const logging = require('../../../shared/logging');
const errors = require('@tryghost/errors');
const debug = require('ghost-ignition').debug('api:themes');

View file

@ -2,7 +2,7 @@ const _ = require('lodash');
const Promise = require('bluebird');
const fs = require('fs-extra');
const config = require('../../../shared/config');
const {i18n} = require('../proxy');
const {i18n} = require('../../../server/lib/common');
const errors = require('@tryghost/errors');
const canActivate = function canActivate(checkedTheme) {