RED-6313, fixed first page not being marked as seen after assigning yourself to file.

This commit is contained in:
George 2023-03-08 12:13:16 +02:00
parent 0221cb46f3
commit 45b4a97f21

View File

@ -4,12 +4,14 @@ import { ViewedPagesService } from '@services/files/viewed-pages.service';
import { FilePreviewStateService } from '../../services/file-preview-state.service';
import { PageRotationService } from '../../../pdf-viewer/services/page-rotation.service';
import { ContextComponent, getConfig } from '@iqser/common-ui';
import { tap } from 'rxjs/operators';
import { map, tap } from 'rxjs/operators';
import { AppConfig, ViewedPage } from '@red/domain';
import { ViewedPagesMapService } from '@services/files/viewed-pages-map.service';
import { pairwise } from 'rxjs';
interface PageIndicatorContext {
isRotated: boolean;
assigneeChanged: boolean;
}
@Component({
@ -47,7 +49,12 @@ export class PageIndicatorComponent extends ContextComponent<PageIndicatorContex
this._changeDetectorRef.detectChanges();
}),
);
super._initContext({ isRotated: isRotated$ });
const assigneeChanged$ = this._state.file$.pipe(
pairwise(),
map(([prevFile, currFile]) => this.active && prevFile.assignee !== currFile.assignee),
tap(assigneeChanged => assigneeChanged && this.handlePageRead()),
);
super._initContext({ isRotated: isRotated$, assigneeChanged: assigneeChanged$ });
}
ngOnChanges() {