diff --git a/apps/red-ui/src/app/models/file/annotation.permissions.ts b/apps/red-ui/src/app/models/file/annotation.permissions.ts index 074dad68a..db08b66c2 100644 --- a/apps/red-ui/src/app/models/file/annotation.permissions.ts +++ b/apps/red-ui/src/app/models/file/annotation.permissions.ts @@ -61,7 +61,7 @@ export class AnnotationPermissions { !permissions.canUndo && annotation.superType !== 'pending-analysis')); - permissions.canChangeLegalBasis = !!annotation.legalBasis; + permissions.canChangeLegalBasis = !annotation.isManualRedaction && annotation.isRedacted; return permissions; } 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 ef54f811c..232a238d8 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -9,6 +9,7 @@ export class AnnotationWrapper { | 'suggestion-change-legal-basis' | 'suggestion-add-dictionary' | 'suggestion-force-redaction' + | 'change-legal-basis' | 'suggestion-remove-dictionary' | 'suggestion-add' | 'suggestion-remove' @@ -48,6 +49,8 @@ export class AnnotationWrapper { isChangeLogEntry?: boolean; changeLogType?: 'ADDED' | 'REMOVED'; + private _origin: RedactionLogEntryWrapper; + constructor() {} get isUndoableSuperType() { @@ -59,6 +62,7 @@ export class AnnotationWrapper { this.superType === 'suggestion-remove-dictionary' || this.superType === 'suggestion-change-legal-basis' || this.superType === 'suggestion-add' || + this.superType === 'change-legal-basis' || this.superType === 'suggestion-remove' || this.superType === 'skipped' || this.superType === 'redaction' || @@ -141,7 +145,8 @@ export class AnnotationWrapper { this.superType === 'add-dictionary' || this.superType === 'remove-dictionary' || this.superType === 'remove-only-here' || - this.superType === 'pending-analysis' + this.superType === 'pending-analysis' || + this.superType === 'change-legal-basis' ); } @@ -210,6 +215,8 @@ export class AnnotationWrapper { static fromData(redactionLogEntry?: RedactionLogEntryWrapper) { const annotationWrapper = new AnnotationWrapper(); + annotationWrapper._origin = redactionLogEntry; + annotationWrapper.annotationId = redactionLogEntry.id; annotationWrapper.force = redactionLogEntry.force; annotationWrapper.isChangeLogEntry = redactionLogEntry.isChangeLogEntry; @@ -253,11 +260,15 @@ export class AnnotationWrapper { annotationWrapper: AnnotationWrapper, redactionLogEntryWrapper: RedactionLogEntryWrapper ) { - if ( - redactionLogEntryWrapper.legalBasisChangeValue && - redactionLogEntryWrapper.status === 'REQUESTED' - ) { - annotationWrapper.superType = 'suggestion-change-legal-basis'; + if (redactionLogEntryWrapper.legalBasisChangeValue) { + if (redactionLogEntryWrapper.status === 'REQUESTED') { + annotationWrapper.superType = 'suggestion-change-legal-basis'; + } else if (redactionLogEntryWrapper.actionPendingReanalysis) { + annotationWrapper.superType = 'change-legal-basis'; + } else { + annotationWrapper.superType = 'redaction'; + } + return; } if (redactionLogEntryWrapper.recommendation) { diff --git a/apps/red-ui/src/app/models/file/file-data.model.ts b/apps/red-ui/src/app/models/file/file-data.model.ts index 1986cdca3..62913a70c 100644 --- a/apps/red-ui/src/app/models/file/file-data.model.ts +++ b/apps/red-ui/src/app/models/file/file-data.model.ts @@ -229,11 +229,11 @@ export class FileDataModel { const relevantRedactionLogEntry = result.find(r => r.id === legalBasisChange.id); if (!relevantRedactionLogEntry) { - // idRemove for something that doesn't exist - skip + // legalBasisChanges for something that doesn't exist - skip return; } else { relevantRedactionLogEntry.legalBasisChangeValue = legalBasisChange.legalBasis; - + relevantRedactionLogEntry.userId = legalBasisChange.user; // if statuses differ if (relevantRedactionLogEntry.status !== legalBasisChange.status) { relevantRedactionLogEntry.actionPendingReanalysis = true; @@ -259,6 +259,18 @@ export class FileDataModel { redactionLogEntry.hidden = true; } } + + if (redactionLogEntry.manualRedactionType === 'LEGAL_BASIS_CHANGE') { + const legalBasisChanges = this.manualRedactions.legalBasisChanges.find( + me => me.id === redactionLogEntry.id + ); + // ADD has been undone - not yet processed + if (!legalBasisChanges) { + redactionLogEntry.manual = false; + redactionLogEntry.manualRedactionType = 'UNDO'; + redactionLogEntry.status = null; + } + } if (redactionLogEntry.manualRedactionType === 'REMOVE') { const foundManualEntry = this.manualRedactions.idsToRemove.find( me => me.id === redactionLogEntry.id diff --git a/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts b/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts index 9aa513b25..ea61f36ff 100644 --- a/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts +++ b/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts @@ -7,7 +7,7 @@ export interface RedactionLogEntryWrapper { id?: string; legalBasis?: string; manual?: boolean; - manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO'; + manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE'; matchedRule?: number; positions?: Array; reason?: string; diff --git a/apps/red-ui/src/app/modules/dossier/components/type-filter/type-filter.component.ts b/apps/red-ui/src/app/modules/dossier/components/type-filter/type-filter.component.ts index 4b551a172..daaebb252 100644 --- a/apps/red-ui/src/app/modules/dossier/components/type-filter/type-filter.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/type-filter/type-filter.component.ts @@ -25,6 +25,7 @@ export class TypeFilterComponent implements OnInit { 'remove-dictionary', 'remove-only-here', 'pending-analysis', + 'change-legal-basis', 'analysis' ]; diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index 45a9a0fe9..03e251741 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -639,6 +639,15 @@ export class AppStateService { true ); + dictionaryData['change-legal-basis'] = new TypeValueWrapper( + { + hexColor: colors.analysisColor, + type: 'analysis' + }, + null, + true + ); + dictionaryData['hint'] = new TypeValueWrapper( { hexColor: '#fa98f7', diff --git a/apps/red-ui/src/app/utils/sorters/super-type-sorter.ts b/apps/red-ui/src/app/utils/sorters/super-type-sorter.ts index 5476b0896..4408f9b5a 100644 --- a/apps/red-ui/src/app/utils/sorters/super-type-sorter.ts +++ b/apps/red-ui/src/app/utils/sorters/super-type-sorter.ts @@ -2,7 +2,8 @@ export const SuperTypeSorter = { 'add-dictionary': 2, 'remove-dictionary': 3, 'pending-analysis': 4, - 'remove-only-here': 5, + 'change-legal-basis': 5, + 'remove-only-here': 6, 'suggestion-add-dictionary': 12, 'suggestion-remove-dictionary': 13, 'suggestion-add': 10, diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index b6bb13c3d..ccb1c8a8d 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -577,6 +577,7 @@ "redaction": "Redaction", "comment": "Comment", "pending-analysis": "Pending Re-Analysis", + "change-legal-basis": "Pending Change of Legal Basis", "suggestion": "Suggestion for redaction", "dictionary": "Dictionary", "type": "Type", @@ -620,10 +621,12 @@ "suggestion-add-dictionary": "Suggested dictionary add", "suggestion-force-redaction": "Suggestion force redaction", "suggestion-remove-dictionary": "Suggested dictionary removal", + "suggestion-change-legal-basis": "Suggested change legal basis", "suggestion-add": "Suggested redaction", "suggestion-remove": "Suggested redaction removal", "skipped": "Skipped", "pending-analysis": "Pending Re-Analysis", + "change-legal-basis": "Pending Change of Legal Basis", "hint": "Hint", "redaction": "Redaction", "manual-redaction": "Manual Redaction",