Skip to content

Commit

Permalink
[AAE-9464] - Fetch image from ACS only in case of ECM (#7779)
Browse files Browse the repository at this point in the history
  • Loading branch information
arditdomi committed Aug 30, 2022
1 parent 6f20972 commit 147fb56
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lib/core/src/lib/userinfo/components/user-info.component.spec.ts
Expand Up @@ -527,7 +527,7 @@ describe('User info component', () => {
expect(fullNameElement.textContent).not.toContain('null');
});

it('should not show initials if the user have avatar', async () => {
it('should not show initials if the user have avatar and provider is ECM', async () => {
getCurrentUserInfoStub.and.returnValue(identityUserWithOutLastNameMock);
getCurrenEcmtUserInfoStub.and.returnValue(of(fakeEcmUser));
isEcmLoggedInStub.and.returnValue(true);
Expand All @@ -537,6 +537,16 @@ describe('User info component', () => {
expect(element.querySelector('.adf-userinfo-profile-image')).toBeDefined();
expect(element.querySelector('.adf-userinfo-profile-image')).not.toBeNull();
});

it('should show initials if the user has avatar but provider is not ECM', async () => {
getCurrentUserInfoStub.and.returnValue(identityUserWithOutLastNameMock);
getCurrenEcmtUserInfoStub.and.returnValue(of(fakeEcmUser));
isEcmLoggedInStub.and.returnValue(false);
await whenFixtureReady();

expect(element.querySelector('.adf-userinfo-pic')).not.toBeNull();
expect(element.querySelector('.adf-userinfo-profile-image')).toBeNull();
});
});

describe('kerberos', () => {
Expand Down
Expand Up @@ -90,7 +90,7 @@ export class UserInfoComponent implements OnInit, OnDestroy {
this.loadIdentityUserInfo();
this.mode = 'SSO';

if (this.authService.isEcmLoggedIn()) {
if (this.authService.isECMProvider() && this.authService.isEcmLoggedIn()) {
this.loadEcmUserInfo();
}

Expand Down

0 comments on commit 147fb56

Please sign in to comment.