Merge pull request #4513 from CatoTH/OS3-Bugfix-Amendment-Diff-Extraction

Bugfix in motion's diff-view: correct amendment diff
This commit is contained in:
Emanuel Schütze 2019-03-16 20:43:54 +01:00 committed by GitHub
commit 1c02d5f496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);