mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
🐛 Fixed vague upload error messages on General and Labs setting screens
no issue - API now returns the "useful" error message in `error.context` rather than `error.message` - updated `{{gh-uploader}}` to expose `context` on errors - updated error display to try using `context` with a fallback to `message`
This commit is contained in:
parent
01559cf447
commit
047f5695b4
3 changed files with 8 additions and 6 deletions
|
@ -275,7 +275,8 @@ export default Component.extend({
|
|||
return true;
|
||||
} catch (error) {
|
||||
// grab custom error message if present
|
||||
let message = error.payload.errors && error.payload.errors[0].message;
|
||||
let message = error.payload.errors && error.payload.errors[0].message || '';
|
||||
let context = error.payload.errors && error.payload.errors[0].context || '';
|
||||
|
||||
// fall back to EmberData/ember-ajax default message for error type
|
||||
if (!message) {
|
||||
|
@ -284,6 +285,7 @@ export default Component.extend({
|
|||
|
||||
let result = {
|
||||
message,
|
||||
context,
|
||||
fileName: file.name
|
||||
};
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<div class="gh-setting-title">Publication icon</div>
|
||||
<div class="gh-setting-desc">A square, social icon used in the UI of your publication, at least 60x60px</div>
|
||||
{{#each uploader.errors as |error|}}
|
||||
<div class="gh-setting-error" data-test-error="icon">{{error.message}}</div>
|
||||
<div class="gh-setting-error" data-test-error="icon">{{or error.context error.message}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="gh-setting-action gh-setting-action-smallimg">
|
||||
|
@ -135,7 +135,7 @@
|
|||
<div class="gh-setting-title">Publication logo</div>
|
||||
<div class="gh-setting-desc">The primary logo for your brand displayed across your theme, should be transparent and at least 600px x 72px</div>
|
||||
{{#each uploader.errors as |error|}}
|
||||
<div class="gh-setting-error" data-test-error="logo">{{error.message}}</div>
|
||||
<div class="gh-setting-error" data-test-error="logo">{{or error.context error.message}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="gh-setting-action gh-setting-action-smallimg">
|
||||
|
@ -167,7 +167,7 @@
|
|||
<div class="gh-setting-title">Publication cover</div>
|
||||
<div class="gh-setting-desc">An optional large background image for your site</div>
|
||||
{{#each uploader.errors as |error|}}
|
||||
<div class="gh-setting-error" data-test-error="coverImage">{{error.message}}</div>
|
||||
<div class="gh-setting-error" data-test-error="coverImage">{{or error.context error.message}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="gh-setting-action gh-setting-action-largeimg">
|
||||
|
|
|
@ -239,7 +239,7 @@
|
|||
<div class="gh-setting-title">Redirects</div>
|
||||
<div class="gh-setting-desc">Configure redirects for old or moved content, more info in <a href="https://docs.ghost.org/tutorials/implementing-redirects/">the docs</a></div>
|
||||
{{#each uploader.errors as |error|}}
|
||||
<div class="gh-setting-error" data-test-error="redirects">{{error.message}}</div>
|
||||
<div class="gh-setting-error" data-test-error="redirects">{{or error.context error.message}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="gh-setting-action" style="display: flex; flex-direction: column">
|
||||
|
@ -284,7 +284,7 @@
|
|||
<div class="gh-setting-title">Routes</div>
|
||||
<div class="gh-setting-desc">Configure dynamic routing by modifying the routes.yaml file</div>
|
||||
{{#each uploader.errors as |error|}}
|
||||
<div class="gh-setting-error" data-test-error="routes">{{error.message}}</div>
|
||||
<div class="gh-setting-error" data-test-error="routes">{{or error.context error.message}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="gh-setting-action" style="display: flex; flex-direction: column">
|
||||
|
|
Loading…
Add table
Reference in a new issue