Skip to content

Commit

Permalink
Merge pull request DSpace#2830 from 4Science/fix-issue-9355
Browse files Browse the repository at this point in the history
[issue-9355] fix error on e2e tests
  • Loading branch information
tdonohue authored Feb 22, 2024
2 parents d5aca76 + 10e8768 commit 1c7f098
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/app/suggestion-notifications/suggestions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { hasValue, isNotEmpty } from '../shared/empty.util';
import { ResearcherProfile } from '../core/profile/model/researcher-profile.model';
import {
getAllSucceededRemoteDataPayload,
getFinishedRemoteData,
getFinishedRemoteData, getFirstCompletedRemoteData,
getFirstSucceededRemoteDataPayload,
getFirstSucceededRemoteListPayload
} from '../core/shared/operators';
Expand Down Expand Up @@ -155,10 +155,10 @@ export class SuggestionsService {
*/
public retrieveCurrentUserSuggestions(userUuid: string): Observable<SuggestionTarget[]> {
return this.researcherProfileService.findById(userUuid, true).pipe(
getFirstSucceededRemoteDataPayload(),
mergeMap((profile: ResearcherProfile) => {
if (isNotEmpty(profile)) {
return this.researcherProfileService.findRelatedItemId(profile).pipe(
getFirstCompletedRemoteData(),
mergeMap((profile: RemoteData<ResearcherProfile> ) => {
if (isNotEmpty(profile) && profile.hasSucceeded && isNotEmpty(profile.payload)) {
return this.researcherProfileService.findRelatedItemId(profile.payload).pipe(
mergeMap((itemId: string) => {
return this.suggestionsDataService.getTargetsByUser(itemId).pipe(
getFirstSucceededRemoteListPayload()
Expand All @@ -169,7 +169,7 @@ export class SuggestionsService {
return of([]);
}
}),
take(1)
catchError(() => of([]))
);
}

Expand Down

0 comments on commit 1c7f098

Please sign in to comment.