mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Renamed variables to match their content
refs https://github.com/TryGhost/Toolbox/issues/280 - The naming of variables should've been vice-versa. Should make the code less confusing now
This commit is contained in:
parent
6804e5d2c6
commit
ebc8881d65
@ -8,12 +8,12 @@ const tpl = require('@tryghost/tpl');
|
|||||||
const messages = {
|
const messages = {
|
||||||
pageNotFound: 'Page not found',
|
pageNotFound: 'Page not found',
|
||||||
resourceNotFound: 'Resource not found',
|
resourceNotFound: 'Resource not found',
|
||||||
methodNotAcceptableVersionBehind: {
|
methodNotAcceptableVersionAhead: {
|
||||||
message: 'Request not acceptable for provided Accept-Version header.',
|
message: 'Request not acceptable for provided Accept-Version header.',
|
||||||
context: 'Provided client version {acceptVersion} is ahead of current Ghost instance version {ghostVersion}.',
|
context: 'Provided client version {acceptVersion} is ahead of current Ghost instance version {ghostVersion}.',
|
||||||
help: 'Upgrade your Ghost instance.'
|
help: 'Upgrade your Ghost instance.'
|
||||||
},
|
},
|
||||||
methodNotAcceptableVersionAhead: {
|
methodNotAcceptableVersionBehind: {
|
||||||
message: 'Request not acceptable for provided Accept-Version header.',
|
message: 'Request not acceptable for provided Accept-Version header.',
|
||||||
context: 'Provided client version {acceptVersion} is outdated and is behind current Ghost version {ghostVersion}.',
|
context: 'Provided client version {acceptVersion} is outdated and is behind current Ghost version {ghostVersion}.',
|
||||||
help: 'Upgrade your Ghost API client.'
|
help: 'Upgrade your Ghost API client.'
|
||||||
@ -195,17 +195,6 @@ module.exports.resourceNotFound = (req, res, next) => {
|
|||||||
|
|
||||||
let errorOptions;
|
let errorOptions;
|
||||||
if (versionComparison === 1) {
|
if (versionComparison === 1) {
|
||||||
errorOptions = {
|
|
||||||
message: tpl(
|
|
||||||
messages.methodNotAcceptableVersionBehind.message
|
|
||||||
),
|
|
||||||
context: tpl(messages.methodNotAcceptableVersionBehind.context, {
|
|
||||||
acceptVersion: req.headers['accept-version'],
|
|
||||||
ghostVersion: `v${res.locals.safeVersion}`
|
|
||||||
}),
|
|
||||||
help: tpl(messages.methodNotAcceptableVersionBehind.help)
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
errorOptions = {
|
errorOptions = {
|
||||||
message: tpl(
|
message: tpl(
|
||||||
messages.methodNotAcceptableVersionAhead.message
|
messages.methodNotAcceptableVersionAhead.message
|
||||||
@ -216,6 +205,17 @@ module.exports.resourceNotFound = (req, res, next) => {
|
|||||||
}),
|
}),
|
||||||
help: tpl(messages.methodNotAcceptableVersionAhead.help)
|
help: tpl(messages.methodNotAcceptableVersionAhead.help)
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
errorOptions = {
|
||||||
|
message: tpl(
|
||||||
|
messages.methodNotAcceptableVersionBehind.message
|
||||||
|
),
|
||||||
|
context: tpl(messages.methodNotAcceptableVersionBehind.context, {
|
||||||
|
acceptVersion: req.headers['accept-version'],
|
||||||
|
ghostVersion: `v${res.locals.safeVersion}`
|
||||||
|
}),
|
||||||
|
help: tpl(messages.methodNotAcceptableVersionBehind.help)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
next(new errors.RequestNotAcceptableError(errorOptions));
|
next(new errors.RequestNotAcceptableError(errorOptions));
|
||||||
|
Loading…
Reference in New Issue
Block a user