From 1fd4c8e05fe4104be1bf59c2a53da9a2ce188623 Mon Sep 17 00:00:00 2001 From: gpapavgeri Date: Fri, 17 Jul 2020 13:42:39 +0300 Subject: [PATCH] get user email from Principal fixed --- .../navigation/user-dialog/user-dialog.component.html | 2 +- .../navigation/user-dialog/user-dialog.component.ts | 6 ++++++ dmp-frontend/src/app/ui/navbar/navbar.component.ts | 11 ----------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/dmp-frontend/src/app/ui/misc/navigation/user-dialog/user-dialog.component.html b/dmp-frontend/src/app/ui/misc/navigation/user-dialog/user-dialog.component.html index 6c083243a..f9aa116ea 100644 --- a/dmp-frontend/src/app/ui/misc/navigation/user-dialog/user-dialog.component.html +++ b/dmp-frontend/src/app/ui/misc/navigation/user-dialog/user-dialog.component.html @@ -4,7 +4,7 @@
diff --git a/dmp-frontend/src/app/ui/misc/navigation/user-dialog/user-dialog.component.ts b/dmp-frontend/src/app/ui/misc/navigation/user-dialog/user-dialog.component.ts index f0be0d5bc..2315661af 100644 --- a/dmp-frontend/src/app/ui/misc/navigation/user-dialog/user-dialog.component.ts +++ b/dmp-frontend/src/app/ui/misc/navigation/user-dialog/user-dialog.component.ts @@ -35,6 +35,12 @@ export class UserDialogComponent implements OnInit { return ''; } + public getPrincipalEmail(): string { + const principal: Principal = this.authentication.current(); + if (principal) { return principal.email; } + return ''; + } + public principalHasAvatar(): boolean { return this.authentication.current() && this.authentication.current().avatarUrl != null && this.authentication.current().avatarUrl.length > 0; } diff --git a/dmp-frontend/src/app/ui/navbar/navbar.component.ts b/dmp-frontend/src/app/ui/navbar/navbar.component.ts index 537fcbb59..50fad84c7 100644 --- a/dmp-frontend/src/app/ui/navbar/navbar.component.ts +++ b/dmp-frontend/src/app/ui/navbar/navbar.component.ts @@ -73,7 +73,6 @@ export class NavbarComponent extends BaseComponent implements OnInit { this.progressIndicationService.getProgressIndicationObservable().pipe(takeUntil(this._destroyed)).subscribe(x => { setTimeout(() => { this.progressIndication = x; }); }); - this.getPrincipalAsUser(); } public isAuthenticated(): boolean { @@ -84,13 +83,6 @@ export class NavbarComponent extends BaseComponent implements OnInit { return this.currentRoute === '/language-editor' || this.currentRoute === '/profile'; } - public getPrincipalAsUser() { - const principal: Principal = this.authentication.current(); - if (principal) { - this.userService.getUser(principal.id).pipe(takeUntil(this._destroyed)).subscribe(result => this.user = result); - } - } - sidebarOpen() { const toggleButton = this.toggleButton; const body = document.getElementsByTagName('body')[0]; @@ -223,9 +215,6 @@ export class NavbarComponent extends BaseComponent implements OnInit { autoFocus: false, closeOnNavigation: true, disableClose: false, - data: { - user: this.user - }, position: { top: '64px', right: '1em' } }); }