mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Added special error modal copy on email freeze
closes https://github.com/TryGhost/Team/issues/913 - When an error is returned from the server during a CSV import and it's because of the email freeze the import modal error has to show a special header along with error message
This commit is contained in:
parent
35ac6abd6a
commit
a7bb783d33
2 changed files with 9 additions and 1 deletions
|
@ -35,7 +35,7 @@
|
|||
|
||||
{{#if (eq this.state 'ERROR')}}
|
||||
<header class="modal-header" data-test-modal="import-members">
|
||||
<h1>Import error</h1>
|
||||
<h1>{{this.errorHeader}}</h1>
|
||||
</header>
|
||||
{{/if}}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ export default ModalComponent.extend({
|
|||
paramName: 'membersfile',
|
||||
importResponse: null,
|
||||
errorMessage: null,
|
||||
errorHeader: null,
|
||||
showMappingErrors: false,
|
||||
|
||||
// Allowed actions
|
||||
|
@ -83,6 +84,7 @@ export default ModalComponent.extend({
|
|||
reset() {
|
||||
this.set('showMappingErrors', false);
|
||||
this.set('errorMessage', null);
|
||||
this.set('errorHeader', null);
|
||||
this.set('file', null);
|
||||
this.set('mapping', null);
|
||||
this.set('state', 'INIT');
|
||||
|
@ -194,6 +196,7 @@ export default ModalComponent.extend({
|
|||
|
||||
_uploadError(error) {
|
||||
let message;
|
||||
let header = 'Import error';
|
||||
|
||||
if (isVersionMismatchError(error)) {
|
||||
this.notifications.showAPIError(error);
|
||||
|
@ -205,11 +208,16 @@ export default ModalComponent.extend({
|
|||
message = 'The file you uploaded was larger than the maximum file size your server allows.';
|
||||
} else if (error.payload && error.payload.errors && !isBlank(error.payload.errors[0].message)) {
|
||||
message = htmlSafe(error.payload.errors[0].message);
|
||||
|
||||
if (error.payload.errors[0].message.match(/list of that size/gi)) {
|
||||
header = 'Woah there cowboy, that\'s a big list';
|
||||
}
|
||||
} else {
|
||||
console.error(error); // eslint-disable-line
|
||||
message = 'Something went wrong :(';
|
||||
}
|
||||
|
||||
this.set('errorMessage', message);
|
||||
this.set('errorHeader', header);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue