diff --git a/client/src/app/core/ui-services/diff.service.ts b/client/src/app/core/ui-services/diff.service.ts
index 3772dbe85..429a671e2 100644
--- a/client/src/app/core/ui-services/diff.service.ts
+++ b/client/src/app/core/ui-services/diff.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
-import { LineNumberedString, LinenumberingService } from './linenumbering.service';
+import { LineNumberedString, LinenumberingService, LineNumberRange } from './linenumbering.service';
import { ViewUnifiedChange } from '../../shared/models/motions/view-unified-change';
const ELEMENT_NODE = 1;
@@ -2149,11 +2149,24 @@ export class DiffService {
paragraphNo: number,
origText: string,
newText: string,
- lineLength: number
+ lineLength: number,
+ changeRecos?: ViewUnifiedChange[]
): DiffLinesInParagraph {
- const paragraph_line_range = this.lineNumberingService.getLineNumberRange(origText),
- diff = this.diff(origText, newText),
- affected_lines = this.detectAffectedLineRange(diff);
+ const paragraph_line_range: LineNumberRange = this.lineNumberingService.getLineNumberRange(origText);
+ let diff = this.diff(origText, newText);
+ const affected_lines = this.detectAffectedLineRange(diff);
+
+ /**
+ * If the affect line has change recos, overwirte the diff with the change reco
+ */
+ if (changeRecos && changeRecos.length) {
+ const recoToThisLine = changeRecos.find(reco => {
+ return reco.getLineFrom() === affected_lines.from;
+ });
+ if (recoToThisLine) {
+ diff = this.diff(origText, recoToThisLine.getChangeNewText());
+ }
+ }
if (affected_lines === null) {
return null;
diff --git a/client/src/app/slides/motions/motion/motion-slide.component.html b/client/src/app/slides/motions/motion/motion-slide.component.html
index 7a594df69..da4608861 100644
--- a/client/src/app/slides/motions/motion/motion-slide.component.html
+++ b/client/src/app/slides/motions/motion/motion-slide.component.html
@@ -68,7 +68,6 @@
-
@@ -78,7 +77,8 @@
{{ preamble | translate }}
+ {{ preamble | translate }}
diff --git a/client/src/app/slides/motions/motion/motion-slide.component.ts b/client/src/app/slides/motions/motion/motion-slide.component.ts
index 0d030af40..103522400 100644
--- a/client/src/app/slides/motions/motion/motion-slide.component.ts
+++ b/client/src/app/slides/motions/motion/motion-slide.component.ts
@@ -78,6 +78,9 @@ export class MotionSlideComponent extends BaseMotionSlideComponent {
- if (newText === null) {
+ (amendmentText: string, paraNo: number): DiffLinesInParagraph => {
+ if (amendmentText === null) {
return null;
}
- // Hint: can be either DiffLinesInParagraph or null, if no changes are made
return this.diff.getAmendmentParagraphsLines(
paraNo,
baseParagraphs[paraNo],
- newText,
- this.lineLength
+ amendmentText,
+ this.lineLength,
+ this.crMode === ChangeRecoMode.Diff ? this.getAllTextChangingObjects() : undefined
);
}
)
.filter((para: DiffLinesInParagraph) => para !== null);
+
+ return amendmentParagraphs;
}
/**
diff --git a/server/openslides/motions/projector.py b/server/openslides/motions/projector.py
index c9801c3a6..16c46f622 100644
--- a/server/openslides/motions/projector.py
+++ b/server/openslides/motions/projector.py
@@ -192,7 +192,6 @@ async def motion_slide(
motions_preamble = await get_config(all_data_provider, "motions_preamble")
# Query all change-recommendation and amendment related things.
- change_recommendations = [] # type: ignore
amendments = [] # type: ignore
base_motion = None
base_statute = None
@@ -201,16 +200,18 @@ async def motion_slide(
elif motion["parent_id"] is not None and motion["amendment_paragraphs"]:
base_motion = await get_amendment_base_motion(motion, all_data_provider)
else:
- for change_recommendation_id in motion["change_recommendations_id"]:
- cr = await get_model(
- all_data_provider,
- "motions/motion-change-recommendation",
- change_recommendation_id,
- )
- if cr is not None and not cr["internal"]:
- change_recommendations.append(cr)
amendments = await get_amendments_for_motion(motion, all_data_provider)
+ change_recommendations = [] # type: ignore
+ for change_recommendation_id in motion["change_recommendations_id"]:
+ cr = await get_model(
+ all_data_provider,
+ "motions/motion-change-recommendation",
+ change_recommendation_id,
+ )
+ if cr is not None and not cr["internal"]:
+ change_recommendations.append(cr)
+
# The base return value. More fields will get added below.
return_value = {
"identifier": motion["identifier"],
diff --git a/server/tests/unit/motions/test_projector.py b/server/tests/unit/motions/test_projector.py
index 9f191b06a..de18e35db 100644
--- a/server/tests/unit/motions/test_projector.py
+++ b/server/tests/unit/motions/test_projector.py
@@ -108,6 +108,7 @@ def all_data_provider():
"created": "2019-01-19T18:37:34.741336+01:00",
"last_modified": "2019-01-19T18:37:34.741368+01:00",
"change_recommendations": [],
+ "change_recommendations_id": [],
"amendments_id": [],
},
3: {
@@ -142,6 +143,7 @@ def all_data_provider():
"created": "2019-01-19T18:37:34.741336+01:00",
"last_modified": "2019-01-19T18:37:34.741368+01:00",
"change_recommendations": [],
+ "change_recommendations_id": [],
"amendments_id": [],
},
}