fix removed annotation click
This commit is contained in:
parent
f74f48f7b2
commit
8c2d75e873
@ -34,7 +34,6 @@
|
||||
&.removed {
|
||||
text-decoration: line-through;
|
||||
color: variables.$grey-7;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.actions-wrapper {
|
||||
|
||||
@ -41,10 +41,6 @@ export class AnnotationsListComponent implements OnChanges {
|
||||
return;
|
||||
}
|
||||
|
||||
if (annotation.isChangeLogRemoved) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.pagesPanelActive.emit(false);
|
||||
|
||||
if (this.isSelected(annotation.annotationId)) {
|
||||
|
||||
@ -5,11 +5,10 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { AutoUnsubscribe, InputWithActionComponent, LoadingService, trackByFactory } from '@iqser/common-ui';
|
||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { firstValueFrom, Observable } from 'rxjs';
|
||||
import { CommentingService } from '../../services/commenting.service';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-comments',
|
||||
@ -23,8 +22,6 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
||||
readonly file$: Observable<File>;
|
||||
@HostBinding('class.hidden') _hidden = true;
|
||||
@ViewChild(InputWithActionComponent) private readonly _input: InputWithActionComponent;
|
||||
private readonly _fileId: string;
|
||||
private readonly _dossierId: string;
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
@ -33,13 +30,10 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
||||
private readonly _commentingService: CommentingService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _changeRef: ChangeDetectorRef,
|
||||
readonly filesMapService: FilesMapService,
|
||||
activatedRoute: ActivatedRoute,
|
||||
private readonly _stateService: FilePreviewStateService,
|
||||
) {
|
||||
super();
|
||||
this._fileId = activatedRoute.snapshot.paramMap.get('fileId');
|
||||
this._dossierId = activatedRoute.snapshot.paramMap.get('dossierId');
|
||||
this.file$ = filesMapService.watch$(this._dossierId, this._fileId);
|
||||
this.file$ = _stateService.file$;
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
@ -58,9 +52,8 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
||||
return;
|
||||
}
|
||||
this._loadingService.start();
|
||||
const commentId = await firstValueFrom(
|
||||
this._manualAnnotationService.addComment(value, this.annotation.id, this._dossierId, this._fileId),
|
||||
);
|
||||
const { dossierId, fileId } = this._stateService;
|
||||
const commentId = await firstValueFrom(this._manualAnnotationService.addComment(value, this.annotation.id, dossierId, fileId));
|
||||
this.annotation.comments.push({
|
||||
text: value,
|
||||
id: commentId,
|
||||
@ -80,7 +73,8 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
||||
async deleteComment($event: MouseEvent, comment: IComment): Promise<void> {
|
||||
$event.stopPropagation();
|
||||
this._loadingService.start();
|
||||
await firstValueFrom(this._manualAnnotationService.deleteComment(comment.id, this.annotation.id, this._dossierId, this._fileId));
|
||||
const { dossierId, fileId } = this._stateService;
|
||||
await firstValueFrom(this._manualAnnotationService.deleteComment(comment.id, this.annotation.id, dossierId, fileId));
|
||||
this.annotation.comments.splice(this.annotation.comments.indexOf(comment), 1);
|
||||
this._changeRef.markForCheck();
|
||||
this._loadingService.stop();
|
||||
|
||||
@ -56,7 +56,6 @@ export class FilesMapService {
|
||||
this._map.get(key).next(newEntities);
|
||||
|
||||
// Emit observables only after entities have been updated
|
||||
|
||||
for (const file of changedEntities) {
|
||||
this._entityChanged$.next(file);
|
||||
}
|
||||
@ -69,9 +68,9 @@ export class FilesMapService {
|
||||
replace(entities: File[]) {
|
||||
const dossierId = entities[0].dossierId;
|
||||
const entityIds = entities.map(entity => entity.id);
|
||||
let existingFiles = this.get(dossierId).filter(file => entityIds.includes(file.fileId));
|
||||
const existingFiles = this.get(dossierId).filter(file => entityIds.includes(file.fileId));
|
||||
entities = entities.filter(entity => {
|
||||
const existingFile = existingFiles.find(existingFile => existingFile.id === entity.id);
|
||||
const existingFile = existingFiles.find(file => file.id === entity.id);
|
||||
return existingFile.lastUpdated !== entity.lastUpdated;
|
||||
});
|
||||
if (entities.length) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user