mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-5249] fix deletion propagation
This commit is contained in:
@@ -135,9 +135,9 @@ describe('SuggestionPageComponent', () => {
|
|||||||
scheduler.schedule(() => fixture.detectChanges());
|
scheduler.schedule(() => fixture.detectChanges());
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
component.ignoreSuggestion('1');
|
component.ignoreSuggestion('1');
|
||||||
tick(101);
|
|
||||||
expect(mockSuggestionsService.ignoreSuggestion).toHaveBeenCalledWith('1');
|
expect(mockSuggestionsService.ignoreSuggestion).toHaveBeenCalledWith('1');
|
||||||
expect(mockSuggestionsTargetStateService.dispatchRefreshUserSuggestionsAction).toHaveBeenCalled();
|
expect(mockSuggestionsTargetStateService.dispatchRefreshUserSuggestionsAction).toHaveBeenCalled();
|
||||||
|
tick(201);
|
||||||
expect(component.updatePage).toHaveBeenCalled();
|
expect(component.updatePage).toHaveBeenCalled();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { ActivatedRoute, Data, Router } from '@angular/router';
|
import { ActivatedRoute, Data, Router } from '@angular/router';
|
||||||
|
|
||||||
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
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 { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { SortDirection, SortOptions, } from '../core/cache/models/sort-options.model';
|
import { SortDirection, SortOptions, } from '../core/cache/models/sort-options.model';
|
||||||
@@ -155,11 +155,10 @@ export class SuggestionsPageComponent implements OnInit {
|
|||||||
* @suggestionId
|
* @suggestionId
|
||||||
*/
|
*/
|
||||||
ignoreSuggestion(suggestionId) {
|
ignoreSuggestion(suggestionId) {
|
||||||
this.suggestionService.ignoreSuggestion(suggestionId).pipe(
|
this.suggestionService.ignoreSuggestion(suggestionId).subscribe(() => {
|
||||||
delay(100)
|
|
||||||
).subscribe(() => {
|
|
||||||
this.suggestionTargetsStateService.dispatchRefreshUserSuggestionsAction();
|
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