legal basis v1

This commit is contained in:
Timo 2021-06-29 19:22:00 +03:00
parent 975bed7380
commit 5f5e2d772c
8 changed files with 48 additions and 11 deletions

View File

@ -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;
}

View File

@ -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) {

View File

@ -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

View File

@ -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<Rectangle>;
reason?: string;

View File

@ -25,6 +25,7 @@ export class TypeFilterComponent implements OnInit {
'remove-dictionary',
'remove-only-here',
'pending-analysis',
'change-legal-basis',
'analysis'
];

View File

@ -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',

View File

@ -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,

View File

@ -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",