RED-6420 - No refreshes anymore for new user notifications

This commit is contained in:
Valentin Mihai 2023-03-27 23:55:57 +03:00
parent a0a3ec5923
commit 994e389169
3 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import { GenericService, List, QueryParam } from '@iqser/common-ui'; import { GenericService, LAST_CHECKED_OFFSET, List, QueryParam, ROOT_CHANGES_KEY } from '@iqser/common-ui';
import { Dossier, DossierStats, IDossierChanges } from '@red/domain'; import { Dossier, DossierStats, IDossierChanges } from '@red/domain';
import { forkJoin, Observable, of, throwError, timer } from 'rxjs'; import { forkJoin, Observable, of, throwError, timer } from 'rxjs';
import { catchError, filter, map, switchMap, take, tap } from 'rxjs/operators'; import { catchError, filter, map, switchMap, take, tap } from 'rxjs/operators';
@ -42,11 +42,11 @@ export class DossiersChangesService extends GenericService<Dossier> {
} }
hasChangesDetails$(): Observable<IDossierChanges> { hasChangesDetails$(): Observable<IDossierChanges> {
const body = { value: this._lastCheckedForChanges.get('root') }; const body = { value: this._lastCheckedForChanges.get(ROOT_CHANGES_KEY) };
const dateBeforeRequest = new Date().toISOString(); const dateBeforeRequest = new Date(Date.now() - LAST_CHECKED_OFFSET).toISOString();
return this._post<IDossierChanges>(body, `${this._defaultModelPath}/changes/details`).pipe( return this._post<IDossierChanges>(body, `${this._defaultModelPath}/changes/details`).pipe(
filter(changes => changes.length > 0), filter(changes => changes.length > 0),
tap(() => this._lastCheckedForChanges.set('root', dateBeforeRequest)), tap(() => this._lastCheckedForChanges.set(ROOT_CHANGES_KEY, dateBeforeRequest)),
); );
} }

View File

@ -35,7 +35,7 @@ export class NotificationsService extends EntitiesService<INotification, Notific
) { ) {
super(); super();
if (this._dossiersCacheService.empty) { if (!this._dossiersCacheService.empty) {
this._dossiersCacheService.load().then(async () => await firstValueFrom(this.loadAll())); this._dossiersCacheService.load().then(async () => await firstValueFrom(this.loadAll()));
} }

@ -1 +1 @@
Subproject commit b4156074eb1951dfaa7e53aeec5611e466d817eb Subproject commit ba21886e27187490c526816c4692c541384e1f5f