1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

🐛 Fixed missing error details when activating a theme with fatal errors

no issue
- the API response for theme activation when a fatal validation error occurred has changed but the client wasn't updated resulting in a modal containing an "Activation failed" header but no details
- updates the error details extraction path and adjusts the tests to match the real API response
This commit is contained in:
Kevin Ansfield 2019-04-11 11:00:13 +01:00
parent 6329ec9c40
commit 55ed3322c8
3 changed files with 15 additions and 12 deletions

View file

@ -137,7 +137,7 @@ export default Controller.extend({
}
}).catch((error) => {
if (isThemeValidationError(error)) {
let errors = error.payload.errors[0].details;
let errors = error.payload.errors[0].details.errors;
let fatalErrors = [];
let normalErrors = [];

View file

@ -16,7 +16,7 @@
<h2 class="mb0 mt4 f5 fw6 red">Fatal Errors</h2>
<p class="mb2 red">Must-fix to activate theme</p>
</div>
<ul class="pa0" data-test-theme-warnings>
<ul class="pa0" data-test-theme-fatal-errors>
{{#each this.fatalErrors as |error|}}
<li class="theme-validation-item theme-fatal-error">
{{gh-theme-error-li error=error}}
@ -31,7 +31,7 @@
<p class="mb2">Highly recommended to fix, functionality <span>could</span> be restricted</p>
</div>
<ul class="pa0" data-test-theme-warnings>
<ul class="pa0" data-test-theme-errors>
{{#each this.errors as |error|}}
<li class="theme-validation-item theme-error">
{{gh-theme-error-li error=error}}

View file

@ -492,8 +492,11 @@ describe('Acceptance: Settings - Design', function () {
{
message: 'Theme is not compatible or contains errors.',
type: 'ThemeValidationError',
details: [
{
details: {
checkedVersion: '2.x',
name: 'casper',
version: '2.9.7',
errors: [{
level: 'error',
rule: 'Assets such as CSS & JS must use the <code>{{asset}}</code> helper',
details: '<p>The listed files should be included using the <code>{{asset}}</code> helper.</p>',
@ -502,9 +505,9 @@ describe('Acceptance: Settings - Design', function () {
ref: '/assets/javascripts/ui.js'
}
]
},
{
}, {
level: 'error',
fatal: true,
rule: 'Templates must contain valid Handlebars.',
failures: [
{
@ -516,8 +519,8 @@ describe('Acceptance: Settings - Design', function () {
message: 'The partial index_meta could not be found'
}
]
}
]
}]
}
}
]
});
@ -533,14 +536,14 @@ describe('Acceptance: Settings - Design', function () {
).to.equal('Activation failed');
expect(
find('[data-test-theme-warnings]').textContent,
find('[data-test-theme-fatal-errors]').textContent,
'top-level errors are displayed in activation errors'
).to.match(/Templates must contain valid Handlebars/);
await click('[data-test-toggle-details]');
await click('[data-test-theme-errors] [data-test-toggle-details]');
expect(
find('.theme-validation-details').textContent,
find('[data-test-theme-errors] .theme-validation-details').textContent,
'top-level errors do not escape HTML in activation errors'
).to.match(/The listed files should be included using the {{asset}} helper/);