diff --git a/apps/red-ui/src/app/models/file/annotation.wrapper.ts b/apps/red-ui/src/app/models/file/annotation.wrapper.ts index 140c98eee..558bad40f 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -54,7 +54,6 @@ export class AnnotationWrapper implements IListable, Record { imported?: boolean; image?: boolean; manual?: boolean; - hidden?: boolean; pending?: boolean; hintDictionary?: boolean; textAfter?: string; @@ -191,10 +190,6 @@ export class AnnotationWrapper implements IListable, Record { return !!SuggestionAddSuperTypes[this.superType]; } - get isSuggestionRemove() { - return this.superType === SuperTypes.SuggestionRemove || this.superType === SuperTypes.SuggestionRemoveDictionary; - } - get isSuggestionLegalBasisChange() { return this.superType === SuperTypes.SuggestionChangeLegalBasis; } diff --git a/apps/red-ui/src/app/models/file/redaction-log.entry.ts b/apps/red-ui/src/app/models/file/redaction-log.entry.ts index 361d1e347..43c92cc74 100644 --- a/apps/red-ui/src/app/models/file/redaction-log.entry.ts +++ b/apps/red-ui/src/app/models/file/redaction-log.entry.ts @@ -37,7 +37,6 @@ export class RedactionLogEntry implements IRedactionLogEntry { redactionLogEntry: IRedactionLogEntry, readonly changeLogType: 'ADDED' | 'REMOVED' | 'CHANGED', readonly isChangeLogEntry: boolean, - readonly hidden: boolean, readonly legalBasisList: ILegalBasis[], readonly hintDictionary: boolean, ) { diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.ts index 70b19dbb1..c4df4eecd 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component, Input, OnChanges } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { PermissionsService } from '@services/permissions.service'; import { AnnotationPermissions } from '@models/file/annotation.permissions'; @@ -7,7 +7,6 @@ import { AnnotationReferencesService } from '../../services/annotation-reference import { MultiSelectService } from '../../services/multi-select.service'; import { FilePreviewStateService } from '../../services/file-preview-state.service'; import { HelpModeService } from '@iqser/common-ui'; -import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service'; import { ViewModeService } from '../../services/view-mode.service'; import { REDAnnotationManager } from '../../../pdf-viewer/services/annotation-manager.service'; @@ -22,6 +21,7 @@ export type AnnotationButtonType = keyof typeof AnnotationButtonTypes; selector: 'redaction-annotation-actions', templateUrl: './annotation-actions.component.html', styleUrls: ['./annotation-actions.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, }) export class AnnotationActionsComponent implements OnChanges { @Input() buttonType: AnnotationButtonType = AnnotationButtonTypes.dark; @@ -31,16 +31,14 @@ export class AnnotationActionsComponent implements OnChanges { annotationPermissions: AnnotationPermissions; constructor( - readonly multiSelectService: MultiSelectService, readonly viewModeService: ViewModeService, - readonly annotationActionsService: AnnotationActionsService, - readonly annotationReferencesService: AnnotationReferencesService, readonly helpModeService: HelpModeService, - private readonly _changeRef: ChangeDetectorRef, - private readonly _annotationManager: REDAnnotationManager, + readonly multiSelectService: MultiSelectService, private readonly _state: FilePreviewStateService, private readonly _permissionsService: PermissionsService, - private readonly _dictionariesMapService: DictionariesMapService, + private readonly _annotationManager: REDAnnotationManager, + readonly annotationActionsService: AnnotationActionsService, + readonly annotationReferencesService: AnnotationReferencesService, ) {} private _annotations: AnnotationWrapper[]; @@ -72,7 +70,6 @@ export class AnnotationActionsComponent implements OnChanges { ngOnChanges(): void { this._setPermissions(); - this._changeRef.markForCheck(); } removeOrSuggestRemoveAnnotation($event: MouseEvent, removeFromDict: boolean) { diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index a2e4bd7c4..d02a0e527 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -188,9 +188,11 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni const wrappers = await this._fileDataService.annotations; const ocrAnnotationIds = wrappers.filter(a => a.isOCR).map(a => a.id); const standardEntries = annotations - .filter(a => !bool(a.getCustomData('changeLogRemoved'))) + .filter(a => !bool(a.getCustomData('changeLogRemoved')) && !this._annotationManager.isHidden(a.Id)) .filter(a => !ocrAnnotationIds.includes(a.Id)); - const nonStandardEntries = annotations.filter(a => bool(a.getCustomData('changeLogRemoved'))); + const nonStandardEntries = annotations.filter( + a => bool(a.getCustomData('changeLogRemoved')) && this._annotationManager.isHidden(a.Id), + ); this._setAnnotationsOpacity(standardEntries, true); this._annotationManager.show(standardEntries); this._annotationManager.hide(nonStandardEntries); @@ -379,7 +381,9 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni tap(annotations => this.deleteAnnotations(...annotations)), ); - const currentPageIfNotHighlightsView$ = combineLatest([this.pdf.currentPage$, this._viewModeService.viewMode$]).pipe( + const currentPage$ = this.pdf.currentPage$.pipe(tap(() => this._annotationManager.showHidden())); + + const currentPageIfNotHighlightsView$ = combineLatest([currentPage$, this._viewModeService.viewMode$]).pipe( filter(([, viewMode]) => viewMode !== ViewModes.TEXT_HIGHLIGHTS), map(([page]) => page), ); diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts index 673b943bd..d4f3e991f 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts @@ -182,11 +182,15 @@ export class FileDataService extends EntitiesService { const changeLogValues = this.#getChangeLogValues(redactionLogEntry, file); + if (changeLogValues.hidden) { + return; + } + const dictionary = this._state.dictionaries.find(dict => dict.type === redactionLogEntry.type); if (!dictionary) { this.missingTypes.add(redactionLogEntry.type); @@ -197,7 +201,6 @@ export class FileDataService extends EntitiesService !sourceKeys.includes(r.id)); - result = result.filter(r => !r.hidden); - - return result; + return result.filter(r => !sourceKeys.includes(r.id)); } #getChangeLogValues( diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts index 7cd273b14..9f1943edf 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts @@ -106,6 +106,11 @@ export class REDAnnotationManager { } } + showHidden() { + const hidden = this.#getByIds([...this.hidden.values()]); + this.show(hidden); + } + #getById(annotation: AnnotationWrapper | string) { return this.#manager.getAnnotationById(getId(annotation)); } diff --git a/libs/red-domain/src/lib/dossiers/dossier.model.ts b/libs/red-domain/src/lib/dossiers/dossier.model.ts index fd2eb2757..c11c62a58 100644 --- a/libs/red-domain/src/lib/dossiers/dossier.model.ts +++ b/libs/red-domain/src/lib/dossiers/dossier.model.ts @@ -27,6 +27,9 @@ export class Dossier implements IDossier, IListable { readonly dossiersListRouterLink: string; readonly id: string; changedDate?: string; + readonly isSoftDeleted: boolean; + readonly isArchived: boolean; + readonly isActive: boolean; constructor(dossier: IDossier) { this.dossierId = dossier.dossierId; @@ -49,6 +52,10 @@ export class Dossier implements IDossier, IListable { this.archivedTime = dossier.archivedTime; this.hasReviewers = !!this.memberIds && this.memberIds.length > 1; + this.isSoftDeleted = this.softDeletedTime !== null; + this.isArchived = this.archivedTime !== null; + this.isActive = !this.isSoftDeleted && !this.isArchived; + this.id = this.dossierId; const routerPath = this.isArchived ? ARCHIVE_ROUTE : DOSSIERS_ROUTE; this.dossiersListRouterLink = `/main/${this.dossierTemplateId}/${routerPath}`; @@ -59,18 +66,6 @@ export class Dossier implements IDossier, IListable { return this.dossierName; } - get isActive(): boolean { - return !this.isSoftDeleted && !this.isArchived; - } - - get isArchived(): boolean { - return this.archivedTime !== null; - } - - get isSoftDeleted(): boolean { - return this.softDeletedTime !== null; - } - hasMember(memberId: string): boolean { return !!this.memberIds && this.memberIds.indexOf(memberId) >= 0; }