Bugfix in motion's diff-view: correct amendment diff

This commit is contained in:
Tobias Hößl 2019-03-16 14:07:05 +01:00
parent e03ec00567
commit 1764447704
No known key found for this signature in database
GPG Key ID: 1D780C7599C2D2A2
1 changed files with 4 additions and 12 deletions

View File

@ -679,26 +679,18 @@ export class MotionRepositoryService extends BaseAgendaContentObjectRepository<V
} }
const origText = baseParagraphs[paraNo], const origText = baseParagraphs[paraNo],
paragraphLines = this.lineNumbering.getLineNumberRange(origText),
diff = this.diff.diff(origText, newText), diff = this.diff.diff(origText, newText),
affectedLines = this.diff.detectAffectedLineRange(diff); affectedLines = this.diff.detectAffectedLineRange(diff);
if (affectedLines === null) { if (affectedLines === null) {
return null; return null;
} }
const affectedDiff = this.diff.formatDiff(
let newTextLines = this.lineNumbering.insertLineNumbers( this.diff.extractRangeByLineNumbers(diff, affectedLines.from, affectedLines.to)
newText,
lineLength,
null,
null,
paragraphLines.from
);
newTextLines = this.diff.formatDiff(
this.diff.extractRangeByLineNumbers(newTextLines, affectedLines.from, affectedLines.to)
); );
const affectedConsolidated = this.diff.diffHtmlToFinalText(affectedDiff);
return new ViewMotionAmendedParagraph(amendment, paraNo, newTextLines, affectedLines); return new ViewMotionAmendedParagraph(amendment, paraNo, affectedConsolidated, affectedLines);
} }
) )
.filter((para: ViewMotionAmendedParagraph) => para !== null); .filter((para: ViewMotionAmendedParagraph) => para !== null);