Fix error for freely editable amendments

Recent changes to amendment had various bugs.
This one regarded the amendment list, where amendments without amendmend
paragraphs returned several errors.
This commit is contained in:
Sean 2020-06-08 16:24:21 +02:00 committed by Emanuel Schütze
parent 4673c741e9
commit d4f211e344
2 changed files with 6 additions and 4 deletions

View File

@ -798,7 +798,7 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo
}
});
return amendment.amendment_paragraphs.map((newText: string, paraNo: number) => {
return amendment.amendment_paragraphs?.map((newText: string, paraNo: number) => {
let paragraph: string;
let paragraphHasChanges;
@ -866,7 +866,7 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo
}
return amendmentParagraphs
.map(
?.map(
(newText: string, paraNo: number): DiffLinesInParagraph => {
if (newText !== null) {
return this.diff.getAmendmentParagraphsLines(
@ -937,7 +937,7 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo
const changedAmendmentParagraphs = this.applyChangesToAmendment(amendment, lineLength, changeRecos, false);
return changedAmendmentParagraphs
.map(
?.map(
(newText: string, paraNo: number): ViewMotionAmendedParagraph => {
if (newText === null) {
return null;

View File

@ -134,12 +134,14 @@ export class AmendmentListComponent extends BaseListViewComponent<ViewMotion> im
*/
public getAmendmentSummary(amendment: ViewMotion): string {
const diffLines = amendment.diffLines;
if (diffLines) {
if (diffLines.length) {
return diffLines
.map(diffLine => {
return this.linenumberingService.stripLineNumbers(diffLine.text);
})
.join('[...]');
} else {
return amendment.text;
}
}