mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
[CST-5307] Refactoring and adding missing unit tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import {BehaviorSubject, Observable} from 'rxjs';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { EPerson } from '../core/eperson/models/eperson.model';
|
||||
import { ProfilePageMetadataFormComponent } from './profile-page-metadata-form/profile-page-metadata-form.component';
|
||||
import { NotificationsService } from '../shared/notifications/notifications.service';
|
||||
@@ -9,18 +9,15 @@ import { RemoteData } from '../core/data/remote-data';
|
||||
import { PaginatedList } from '../core/data/paginated-list.model';
|
||||
import { filter, switchMap, tap } from 'rxjs/operators';
|
||||
import { EPersonDataService } from '../core/eperson/eperson-data.service';
|
||||
import {
|
||||
getAllSucceededRemoteData,
|
||||
getRemoteDataPayload,
|
||||
getFirstCompletedRemoteData, getFirstSucceededRemoteDataPayload
|
||||
} from '../core/shared/operators';
|
||||
import { getAllSucceededRemoteData, getFirstCompletedRemoteData, getRemoteDataPayload } from '../core/shared/operators';
|
||||
import { hasValue, isNotEmpty } from '../shared/empty.util';
|
||||
import { followLink } from '../shared/utils/follow-link-config.model';
|
||||
import { AuthService } from '../core/auth/auth.service';
|
||||
import { Operation } from 'fast-json-patch';
|
||||
import { AuthorizationDataService } from '../core/data/feature-authorization/authorization-data.service';
|
||||
import { FeatureID } from '../core/data/feature-authorization/feature-id';
|
||||
import {ConfigurationDataService} from '../core/data/configuration-data.service';
|
||||
import { ConfigurationDataService } from '../core/data/configuration-data.service';
|
||||
import { ConfigurationProperty } from '../core/shared/configuration-property.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-profile-page',
|
||||
@@ -94,8 +91,10 @@ export class ProfilePageComponent implements OnInit {
|
||||
this.canChangePassword$ = this.user$.pipe(switchMap((user: EPerson) => this.authorizationService.isAuthorized(FeatureID.CanChangePassword, user._links.self.href)));
|
||||
|
||||
this.configurationService.findByPropertyName('researcher-profile.entity-type').pipe(
|
||||
getFirstSucceededRemoteDataPayload()
|
||||
).subscribe(() => this.isResearcherProfileEnabled$.next(true));
|
||||
getFirstCompletedRemoteData()
|
||||
).subscribe((configRD: RemoteData<ConfigurationProperty>) => {
|
||||
this.isResearcherProfileEnabled$.next(configRD.hasSucceeded && configRD.payload.values.length > 0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,8 +174,8 @@ export class ProfilePageComponent implements OnInit {
|
||||
/**
|
||||
* Returns true if the researcher profile feature is enabled, false otherwise.
|
||||
*/
|
||||
isResearcherProfileEnabled(){
|
||||
return this.isResearcherProfileEnabled$;
|
||||
isResearcherProfileEnabled(): Observable<boolean> {
|
||||
return this.isResearcherProfileEnabled$.asObservable();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user