diff --git a/client/src/app/core/repositories/motions/motion-repository.service.ts b/client/src/app/core/repositories/motions/motion-repository.service.ts index 97f822bd1..7ae4992dc 100644 --- a/client/src/app/core/repositories/motions/motion-repository.service.ts +++ b/client/src/app/core/repositories/motions/motion-repository.service.ts @@ -705,25 +705,45 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo * * @param {ViewMotion} amendment * @param {number} lineLength + * @param {boolean} includeUnchanged * @returns {DiffLinesInParagraph} */ - public getAmendedParagraphs(amendment: ViewMotion, lineLength: number): DiffLinesInParagraph[] { + public getAmendmentParagraphs( + amendment: ViewMotion, + lineLength: number, + includeUnchanged: boolean + ): DiffLinesInParagraph[] { const motion = this.getAmendmentBaseMotion(amendment); const baseParagraphs = this.getTextParagraphs(motion, true, lineLength); return amendment.amendment_paragraphs .map( (newText: string, paraNo: number): DiffLinesInParagraph => { - if (newText === null) { - return null; + if (newText !== null) { + return this.diff.getAmendmentParagraphsLinesByMode( + paraNo, + baseParagraphs[paraNo], + newText, + lineLength + ); + } else { + // Nothing has changed in this paragraph + if (includeUnchanged) { + const paragraph_line_range = this.lineNumbering.getLineNumberRange(baseParagraphs[paraNo]); + return { + paragraphNo: paraNo, + paragraphLineFrom: paragraph_line_range.from, + paragraphLineTo: paragraph_line_range.to, + diffLineFrom: paragraph_line_range.to, + diffLineTo: paragraph_line_range.to, + textPre: baseParagraphs[paraNo], + text: '', + textPost: '' + } as DiffLinesInParagraph; + } else { + return null; // null will make this paragraph filtered out + } } - // Hint: can be either DiffLinesInParagraph or null, if no changes are made - return this.diff.getAmendmentParagraphsLinesByMode( - paraNo, - baseParagraphs[paraNo], - newText, - lineLength - ); } ) .filter((para: DiffLinesInParagraph) => para !== null); diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html index f0f4e2441..c9a7cfba0 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html @@ -865,11 +865,11 @@
-
+
No changes at the text.
-
-
-
-

- -
-
-
diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts index f484b735c..61ba6e4fa 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts @@ -864,10 +864,11 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit, /** * If `this.motion` is an amendment, this returns the list of all changed paragraphs. * + * @param {boolean} includeUnchanged * @returns {DiffLinesInParagraph[]} */ - public getAmendedParagraphs(): DiffLinesInParagraph[] { - return this.repo.getAmendedParagraphs(this.motion, this.lineLength); + public getAmendmentParagraphs(includeUnchanged: boolean): DiffLinesInParagraph[] { + return this.repo.getAmendmentParagraphs(this.motion, this.lineLength, includeUnchanged); } /** diff --git a/client/src/app/site/motions/services/motion-pdf.service.ts b/client/src/app/site/motions/services/motion-pdf.service.ts index 748868d35..f648f1032 100644 --- a/client/src/app/site/motions/services/motion-pdf.service.ts +++ b/client/src/app/site/motions/services/motion-pdf.service.ts @@ -553,7 +553,7 @@ export class MotionPdfService { motionText = ''; // this is logically redundant with the formation of amendments in the motion-detail html. // Should be refactored in a way that a service returns the correct html for both cases - for (const paragraph of this.motionRepo.getAmendedParagraphs(motion, lineLength)) { + for (const paragraph of this.motionRepo.getAmendmentParagraphs(motion, lineLength, false)) { if (paragraph.diffLineTo === paragraph.diffLineFrom + 1) { motionText += `

${this.translate.instant('Line')} ${paragraph.diffLineFrom}: