diff --git a/client/src/app/domain/models/motions/motion.ts b/client/src/app/domain/models/motions/motion.ts index 5e1a26059c..020c9862a1 100644 --- a/client/src/app/domain/models/motions/motion.ts +++ b/client/src/app/domain/models/motions/motion.ts @@ -97,7 +97,9 @@ export class Motion extends BaseModel implements MotionFormattingReprese } public amendment_paragraph_text(paragraphNumber: number): string | null { - return this.amendment_paragraphs[paragraphNumber] ?? null; + return this.amendment_paragraphs && this.amendment_paragraphs[paragraphNumber] + ? this.amendment_paragraphs[paragraphNumber] + : null; } public static readonly REQUESTABLE_FIELDS: (keyof Motion)[] = [ diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-manage-title/motion-manage-title.component.ts b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-manage-title/motion-manage-title.component.ts index 6db095ee96..3a750da10f 100644 --- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-manage-title/motion-manage-title.component.ts +++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-manage-title/motion-manage-title.component.ts @@ -51,7 +51,7 @@ export class MotionManageTitleComponent extends BaseMotionDetailChildComponent { } public titleCanBeChanged(): boolean { - if (this.motion.isStatuteAmendment() || this.motion.isParagraphBasedAmendment()) { + if (this.motion.isAmendment()) { return false; } return this.changeRecoMode === ChangeRecoMode.Original || this.changeRecoMode === ChangeRecoMode.Diff; diff --git a/client/src/app/site/pages/meetings/pages/motions/view-models/view-motion.ts b/client/src/app/site/pages/meetings/pages/motions/view-models/view-motion.ts index 41445e9382..4ab8952cd1 100644 --- a/client/src/app/site/pages/meetings/pages/motions/view-models/view-motion.ts +++ b/client/src/app/site/pages/meetings/pages/motions/view-models/view-motion.ts @@ -324,10 +324,6 @@ export class ViewMotion extends BaseProjectableViewModel { return !!(this.tags && this.tags.length > 0); } - public isStatuteAmendment(): boolean { - return !!this.statute_paragraph_id; - } - /** * Determine if the motion is in its final workflow state */ @@ -335,12 +331,20 @@ export class ViewMotion extends BaseProjectableViewModel { return this.state ? this.state.isFinalState : false; } + public isAmendment(): boolean { + return this.lead_motion_id && this.lead_motion_id > 0; + } + /** * It's a paragraph-based amendments if only one paragraph is to be changed, * specified by -array */ public isParagraphBasedAmendment(): boolean { - return this.lead_motion_id && this.lead_motion_id > 0; + return this.amendment_paragraph_numbers?.length > 0; + } + + public isStatuteAmendment(): boolean { + return !!this.statute_paragraph_id; } public override getProjectionBuildDescriptor( @@ -369,7 +373,7 @@ export class ViewMotion extends BaseProjectableViewModel { } public getProjectiondefault(): ProjectiondefaultValue { - if (this.isParagraphBasedAmendment()) { + if (this.isAmendment()) { return PROJECTIONDEFAULT.amendment; } else { return PROJECTIONDEFAULT.motion;