mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[CST-5249] fix deletion propagation
This commit is contained in:
@@ -135,9 +135,9 @@ describe('SuggestionPageComponent', () => {
|
||||
scheduler.schedule(() => fixture.detectChanges());
|
||||
scheduler.flush();
|
||||
component.ignoreSuggestion('1');
|
||||
tick(101);
|
||||
expect(mockSuggestionsService.ignoreSuggestion).toHaveBeenCalledWith('1');
|
||||
expect(mockSuggestionsTargetStateService.dispatchRefreshUserSuggestionsAction).toHaveBeenCalled();
|
||||
tick(201);
|
||||
expect(component.updatePage).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
|
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Data, Router } from '@angular/router';
|
||||
|
||||
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
||||
import { delay, distinctUntilChanged, map, switchMap, take } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, map, switchMap, take } from 'rxjs/operators';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { SortDirection, SortOptions, } from '../core/cache/models/sort-options.model';
|
||||
@@ -155,11 +155,10 @@ export class SuggestionsPageComponent implements OnInit {
|
||||
* @suggestionId
|
||||
*/
|
||||
ignoreSuggestion(suggestionId) {
|
||||
this.suggestionService.ignoreSuggestion(suggestionId).pipe(
|
||||
delay(100)
|
||||
).subscribe(() => {
|
||||
this.suggestionService.ignoreSuggestion(suggestionId).subscribe(() => {
|
||||
this.suggestionTargetsStateService.dispatchRefreshUserSuggestionsAction();
|
||||
this.updatePage();
|
||||
//We add a little delay in the page refresh so that we ensure the deletion has been propagated
|
||||
setTimeout(() => this.updatePage(), 200);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user