mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05: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
7cd6c786f9
commit
8826f0e66a
3 changed files with 4 additions and 4 deletions
|
@ -18,7 +18,7 @@ export default ModalComponent.extend({
|
||||||
this.send('closeModal');
|
this.send('closeModal');
|
||||||
}).catch((errors) => {
|
}).catch((errors) => {
|
||||||
let [error] = 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.errors').add('email', error);
|
||||||
this.get('model.hasValidated').pushObject('email');
|
this.get('model.hasValidated').pushObject('email');
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ function mockSubscribers(server) {
|
||||||
if (subscriber) {
|
if (subscriber) {
|
||||||
return new Mirage.Response(422, {}, {
|
return new Mirage.Response(422, {}, {
|
||||||
errors: [{
|
errors: [{
|
||||||
errorType: 'DataImportError',
|
errorType: 'ValidationError',
|
||||||
message: 'duplicate email',
|
message: 'Email already exists.',
|
||||||
property: 'email'
|
property: 'email'
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
|
@ -177,7 +177,7 @@ describe('Acceptance: Subscribers', function() {
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
// the validation error is displayed
|
// the validation error is displayed
|
||||||
expect(find('.fullscreen-modal .error .response').text().trim(), 'duplicate email validation')
|
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
|
// the subscriber is not added to the table
|
||||||
expect(find('.lt-cell:contains(test@example.com)').length, 'number of "test@example.com rows"')
|
expect(find('.lt-cell:contains(test@example.com)').length, 'number of "test@example.com rows"')
|
||||||
|
|
Loading…
Add table
Reference in a new issue