RED-8623: reverted filtering notification changes on certain pages.

This commit is contained in:
Nicoleta Panaghiu 2024-04-02 16:35:38 +03:00
parent 8290f1e276
commit c5b28df758

View File

@ -12,8 +12,6 @@ import { DossiersCacheService } from './dossiers/dossiers-cache.service';
import dayjs from 'dayjs';
import { List, mapEach } from '@iqser/common-ui/lib/utils';
import { APP_BASE_HREF } from '@angular/common';
import { Router } from '@angular/router';
import { filterEventsOnPages } from '@utils/operators';
const INCLUDE_SEEN = false;
@ -35,7 +33,6 @@ export class NotificationsService extends EntitiesService<INotification, Notific
private readonly _translateService: TranslateService,
private readonly _userService: UserService,
private readonly _dossiersCacheService: DossiersCacheService,
private readonly _router: Router,
) {
super();
@ -107,16 +104,12 @@ export class NotificationsService extends EntitiesService<INotification, Notific
#initTimerAndChanges() {
const timer$ = timer(0, CHANGED_CHECK_INTERVAL).pipe(
filterEventsOnPages(this._router),
switchMap(() => (this._dossiersCacheService.empty ? this._dossiersCacheService.load() : of(null))),
switchMap(() => this.#loadNotificationsIfChanged()),
);
// Rebuild notifications when cached dossiers are updated
const changed$ = this._dossiersCacheService.changed$.pipe(
filterEventsOnPages(this._router),
tap(() => this.setEntities(this.all.map(e => this._new(e)))),
);
const changed$ = this._dossiersCacheService.changed$.pipe(tap(() => this.setEntities(this.all.map(e => this._new(e)))));
return merge(timer$, changed$);
}