[ADF-3281] - fixed error when user try to involve people (#3538)

* [ADF-3281] moved current user retrieving in the constructor

* [ADF-3281] moved current user retrieving in the constructor #2
This commit is contained in:
Vito
2018-06-29 10:21:27 +01:00
committed by Eugenio Romano
parent a920c581df
commit d7faaf51b9
2 changed files with 9 additions and 6 deletions

View File

@@ -17,15 +17,19 @@
import { NoTaskDetailsTemplateDirective } from './no-task-detail-template.directive';
import { TaskDetailsComponent } from './task-details.component';
import { FormRenderingService } from '@alfresco/adf-core';
import { FormRenderingService, AuthenticationService } from '@alfresco/adf-core';
import { Observable } from 'rxjs/Observable';
describe('NoTaskDetailsTemplateDirective', () => {
let component: NoTaskDetailsTemplateDirective;
let detailsComponent: TaskDetailsComponent;
let authService: AuthenticationService;
beforeEach(() => {
detailsComponent = new TaskDetailsComponent(null, null, null, new FormRenderingService(), null, null, null);
authService = new AuthenticationService(null, null, null, null);
spyOn(authService, 'getBpmLoggedUser').and.returnValue(Observable.of({ email: 'fake-email'}));
detailsComponent = new TaskDetailsComponent(null, authService, null, new FormRenderingService(), null, null, null);
component = new NoTaskDetailsTemplateDirective(detailsComponent);
});

View File

@@ -195,6 +195,9 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
this.formRenderingService.setComponentTypeResolver('select-folder', () => AttachFolderWidgetComponent, true);
this.formRenderingService.setComponentTypeResolver('upload', () => AttachFileWidgetComponent, true);
this.peopleSearch = new Observable<UserProcessModel[]>(observer => this.peopleSearchObserver = observer).share();
this.authService.getBpmLoggedUser().subscribe((user: UserRepresentation) => {
this.currentLoggedUser = user;
});
}
ngOnInit() {
@@ -204,10 +207,6 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
this.cardViewUpdateService.itemUpdated$.subscribe(this.updateTaskDetails.bind(this));
this.cardViewUpdateService.itemClicked$.subscribe(this.clickTaskDetails.bind(this));
this.authService.getBpmLoggedUser().subscribe((user: UserRepresentation) => {
this.currentLoggedUser = user;
});
}
ngOnChanges(changes: SimpleChanges): void {