From 8dc7eeb2425152c5405ff875c81a90db346f056f Mon Sep 17 00:00:00 2001 From: FrancescoMolinaro Date: Tue, 13 Feb 2024 12:37:29 +0100 Subject: [PATCH] [CST-5249] fix suggestion refresh after ignore --- .../suggestion-data.service.spec.ts | 2 +- .../suggestion-notifications/suggestions-data.service.ts | 2 +- src/app/suggestions-page/suggestions-page.component.ts | 6 ++++-- src/assets/i18n/en.json5 | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/app/core/suggestion-notifications/suggestion-data.service.spec.ts b/src/app/core/suggestion-notifications/suggestion-data.service.spec.ts index a854514c89..c0bc97ea12 100644 --- a/src/app/core/suggestion-notifications/suggestion-data.service.spec.ts +++ b/src/app/core/suggestion-notifications/suggestion-data.service.spec.ts @@ -155,7 +155,7 @@ describe('SuggestionDataService test', () => { searchParams: [new RequestParam('target', testUserId), new RequestParam('source', testSource)] }; service.getSuggestionsByTargetAndSource(testUserId, testSource); - expect(suggestionsDataService.searchBy).toHaveBeenCalledWith('findByTargetAndSource', options, true, true); + expect(suggestionsDataService.searchBy).toHaveBeenCalledWith('findByTargetAndSource', options, false, true); }); it('should call suggestionsDataService.delete', () => { diff --git a/src/app/core/suggestion-notifications/suggestions-data.service.ts b/src/app/core/suggestion-notifications/suggestions-data.service.ts index 8956cbd208..17b1482578 100644 --- a/src/app/core/suggestion-notifications/suggestions-data.service.ts +++ b/src/app/core/suggestion-notifications/suggestions-data.service.ts @@ -217,7 +217,7 @@ export class SuggestionsDataService { new RequestParam('source', source) ]; - return this.suggestionsDataService.searchBy(this.searchFindByTargetAndSourceMethod, options, true, true, ...linksToFollow); + return this.suggestionsDataService.searchBy(this.searchFindByTargetAndSourceMethod, options, false, true, ...linksToFollow); } /** diff --git a/src/app/suggestions-page/suggestions-page.component.ts b/src/app/suggestions-page/suggestions-page.component.ts index 2005646010..d775a1e220 100644 --- a/src/app/suggestions-page/suggestions-page.component.ts +++ b/src/app/suggestions-page/suggestions-page.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Data, Router } from '@angular/router'; import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; -import { distinctUntilChanged, map, switchMap, take } from 'rxjs/operators'; +import { delay, distinctUntilChanged, map, switchMap, take } from 'rxjs/operators'; import { TranslateService } from '@ngx-translate/core'; import { SortDirection, SortOptions, } from '../core/cache/models/sort-options.model'; @@ -155,7 +155,9 @@ export class SuggestionsPageComponent implements OnInit { * @suggestionId */ ignoreSuggestion(suggestionId) { - this.suggestionService.ignoreSuggestion(suggestionId).subscribe(() => { + this.suggestionService.ignoreSuggestion(suggestionId).pipe( + delay(100) + ).subscribe(() => { this.suggestionTargetsStateService.dispatchRefreshUserSuggestionsAction(); this.updatePage(); }); diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 97884bfb51..15134a01fd 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -3120,7 +3120,7 @@ "mydspace.import": "Import", - "notification.suggestion": "We found {{count}} publications
in the {{source}} that seems to be related to your profile.
Please review the suggestions", + "notification.suggestion": "We found {{count}} publications in the {{source}} that seems to be related to your profile.
Please review the suggestions", "nav.browse.header": "All of DSpace",