mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-13 14:39:52 +03:00
Fix display of server-provided validation error when adding subscriber
no issue - make the check for "email" in the server provided error case-insensitive
This commit is contained in:
parent
e6fe1c672c
commit
88847d3b4a
@ -18,7 +18,7 @@ export default ModalComponent.extend({
|
||||
this.send('closeModal');
|
||||
}).catch((errors) => {
|
||||
let [error] = errors;
|
||||
if (error && error.match(/email/)) {
|
||||
if (error && error.match(/email/i)) {
|
||||
this.get('model.errors').add('email', error);
|
||||
this.get('model.hasValidated').pushObject('email');
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ function mockSubscribers(server) {
|
||||
if (subscriber) {
|
||||
return new Mirage.Response(422, {}, {
|
||||
errors: [{
|
||||
errorType: 'DataImportError',
|
||||
message: 'duplicate email',
|
||||
errorType: 'ValidationError',
|
||||
message: 'Email already exists.',
|
||||
property: 'email'
|
||||
}]
|
||||
});
|
||||
|
@ -177,7 +177,7 @@ describe('Acceptance: Subscribers', function() {
|
||||
andThen(function () {
|
||||
// the validation error is displayed
|
||||
expect(find('.fullscreen-modal .error .response').text().trim(), 'duplicate email validation')
|
||||
.to.match(/duplicate/);
|
||||
.to.equal('Email already exists.');
|
||||
|
||||
// the subscriber is not added to the table
|
||||
expect(find('.lt-cell:contains(test@example.com)').length, 'number of "test@example.com rows"')
|
||||
|
Loading…
Reference in New Issue
Block a user