mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-2040] handle invalid email cases on join request (#857)
* [ACA-2040] handle invalid email cases on join request * [ACA-2040] fix json * [ACA-2040] unit test
This commit is contained in:
committed by
Denys Vuika
parent
01a7a8efb6
commit
db66c72a06
@@ -35,6 +35,7 @@ import { AppTestingModule } from '../testing/app-testing.module';
|
||||
import { DirectivesModule } from './directives.module';
|
||||
import { LibraryMembershipDirective } from './library-membership.directive';
|
||||
import { NO_ERRORS_SCHEMA, SimpleChange } from '@angular/core';
|
||||
import { throwError } from 'rxjs';
|
||||
|
||||
describe('LibraryMembershipDirective', () => {
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
@@ -165,5 +166,18 @@ describe('LibraryMembershipDirective', () => {
|
||||
expect(addMembershipSpy).toHaveBeenCalled();
|
||||
expect(deleteMembershipSpy).not.toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should emit error when the request to join a library fails', fakeAsync(() => {
|
||||
spyOn(directive.error, 'emit');
|
||||
addMembershipSpy.and.returnValue(throwError('err'));
|
||||
|
||||
const selection = { entry: { id: 'no-membership-requested' } };
|
||||
const change = new SimpleChange(null, selection, true);
|
||||
directive.ngOnChanges({ selection: change });
|
||||
tick();
|
||||
directive.toggleMembershipRequest();
|
||||
tick();
|
||||
expect(directive.error.emit).toHaveBeenCalled();
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
@@ -130,6 +130,18 @@ export class LibraryMembershipDirective implements OnChanges {
|
||||
error,
|
||||
i18nKey: 'APP.MESSAGES.ERRORS.JOIN_REQUEST_FAILED'
|
||||
};
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
this.error.emit(errWithMessage);
|
||||
}
|
||||
);
|
||||
|
@@ -277,7 +277,8 @@
|
||||
"DELETE_LIBRARY_FAILED": "Cannot delete the library",
|
||||
"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"
|
||||
"LEAVE_LIBRARY_FAILED": "Cannot leave this library",
|
||||
"INVALID_EMAIL": "Sender or receiver email configured on server not valid, contact IT"
|
||||
},
|
||||
"UPLOAD": {
|
||||
"ERROR": {
|
||||
|
Reference in New Issue
Block a user