mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-2040] show different email invalid error messages (#862)
This commit is contained in:
committed by
Denys Vuika
parent
b2244cb1c4
commit
904c08461d
@@ -179,5 +179,35 @@ describe('LibraryMembershipDirective', () => {
|
||||
tick();
|
||||
expect(directive.error.emit).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should emit specific error message on invalid email address server error', fakeAsync(() => {
|
||||
const emitErrorSpy = spyOn(directive.error, 'emit');
|
||||
const selection = { entry: { id: 'no-membership-requested' } };
|
||||
const change = new SimpleChange(null, selection, true);
|
||||
directive.ngOnChanges({ selection: change });
|
||||
tick();
|
||||
|
||||
const testData = [
|
||||
{
|
||||
fixture: 'Failed to resolve sender mail address',
|
||||
expected: 'APP.MESSAGES.ERRORS.INVALID_SENDER_EMAIL'
|
||||
},
|
||||
{
|
||||
fixture: 'All recipients for the mail action were invalid',
|
||||
expected: 'APP.MESSAGES.ERRORS.INVALID_RECEIVER_EMAIL'
|
||||
}
|
||||
];
|
||||
|
||||
testData.forEach(data => {
|
||||
addMembershipSpy.and.returnValue(throwError({ message: data.fixture }));
|
||||
emitErrorSpy.calls.reset();
|
||||
directive.toggleMembershipRequest();
|
||||
tick();
|
||||
expect(emitErrorSpy).toHaveBeenCalledWith({
|
||||
error: { message: data.fixture },
|
||||
i18nKey: data.expected
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
@@ -134,12 +134,15 @@ export class LibraryMembershipDirective implements OnChanges {
|
||||
const senderEmailCheck = 'Failed to resolve sender mail address';
|
||||
const receiverEmailCheck =
|
||||
'All recipients for the mail action were invalid';
|
||||
if (
|
||||
error.message &&
|
||||
(error.message.includes(senderEmailCheck) ||
|
||||
error.message.includes(receiverEmailCheck))
|
||||
) {
|
||||
errWithMessage.i18nKey = 'APP.MESSAGES.ERRORS.INVALID_EMAIL';
|
||||
|
||||
if (error.message) {
|
||||
if (error.message.includes(senderEmailCheck)) {
|
||||
errWithMessage.i18nKey =
|
||||
'APP.MESSAGES.ERRORS.INVALID_SENDER_EMAIL';
|
||||
} else if (error.message.includes(receiverEmailCheck)) {
|
||||
errWithMessage.i18nKey =
|
||||
'APP.MESSAGES.ERRORS.INVALID_RECEIVER_EMAIL';
|
||||
}
|
||||
}
|
||||
|
||||
this.error.emit(errWithMessage);
|
||||
|
@@ -278,7 +278,8 @@
|
||||
"JOIN_REQUEST_FAILED": "Cannot join the library",
|
||||
"JOIN_CANCEL_FAILED": "Cannot cancel the request to join the library",
|
||||
"LEAVE_LIBRARY_FAILED": "Cannot leave this library",
|
||||
"INVALID_EMAIL": "Sender or receiver email configured on server not valid, contact IT"
|
||||
"INVALID_SENDER_EMAIL": "Your email address must be valid before requesting to join.",
|
||||
"INVALID_RECEIVER_EMAIL": "Recipient(s) email address not valid, contact IT."
|
||||
},
|
||||
"UPLOAD": {
|
||||
"ERROR": {
|
||||
|
Reference in New Issue
Block a user