diff --git a/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts b/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts index eae0e49c0..7e913f2e6 100644 --- a/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts +++ b/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts @@ -278,7 +278,7 @@ export class MotionListComponent extends ListViewBaseComponent('motions_line_length'); + + // lead motion or normal amendments + // TODO: Consider title change recommendation + const changes: ViewUnifiedChange[] = Object.assign([], this.changeRecoRepo.getChangeRecoOfMotion(motion.id)); + + // TODO: Cleanup, everything change reco and amendment based needs a unified structure. + const amendments = this.motionRepo.getAmendmentsInstantly(motion.id); + if (amendments) { + for (const amendment of amendments) { + const changedParagraphs = this.motionRepo.getAmendmentAmendedParagraphs(amendment, lineLength); + for (const change of changedParagraphs) { + changes.push(change as ViewUnifiedChange); + } + } + } + + // changes need to be sorted, by "line from". + // otherwise, formatMotion will make unexpected results by messing up the + // order of changes applied to the motion + changes.sort((a, b) => a.getLineFrom() - b.getLineFrom()); + const text = this.motionRepo.formatMotion(motion.id, crMode, changes, lineLength); + + return this.linenumberingService.stripLineNumbers(text); + } + /** * Export all motions as CSV * * @param motions Motions to export * @param contentToExport content properties to export + * @param crMode */ - public exportMotionList(motions: ViewMotion[], contentToExport: string[]): void { + public exportMotionList(motions: ViewMotion[], contentToExport: string[], crMode?: ChangeRecoMode): void { + if (!crMode) { + crMode = this.configService.instant('motions_recommendation_text_mode'); + } + const properties = sortMotionPropertyList(['identifier', 'title'].concat(contentToExport)); const exportProperties: ( | CsvColumnDefinitionProperty @@ -51,6 +102,11 @@ export class MotionCsvExportService { label: 'state', map: motion => this.motionRepo.getExtendedStateLabel(motion) }; + } else if (option === 'text') { + return { + label: 'Text', + map: motion => this.createText(motion, crMode) + }; } else if (option === 'motion_block') { return { label: 'Motion block',