From 92322656b3895e253a2140fa87c582cb099ea71a Mon Sep 17 00:00:00 2001 From: Elblinator Date: Tue, 22 Oct 2024 17:05:59 +0200 Subject: [PATCH 1/2] Fix motion create form --- .../components/motion-form/motion-form.component.ts | 13 ++++++++++++- .../motion-permission.service.ts | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-form/components/motion-form/motion-form.component.ts b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-form/components/motion-form/motion-form.component.ts index f43f344ac3..1a6b73cea9 100644 --- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-form/components/motion-form/motion-form.component.ts +++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-form/components/motion-form/motion-form.component.ts @@ -100,6 +100,10 @@ export class MotionFormComponent extends BaseMeetingComponent implements OnInit return this.perms.isAllowed(`change_metadata`, this.motion); } + public get canManageAgenda(): boolean { + return this.perms.canManageAgenda(); + } + public get isParagraphBasedAmendment(): boolean { return this.isExisting && this.motion.isParagraphBasedAmendment(); } @@ -208,6 +212,11 @@ export class MotionFormComponent extends BaseMeetingComponent implements OnInit return async () => { const update = event || this.temporaryMotion; if (this.newMotion) { + for (const key in update) { + if (update[key] === null || update[key].length === 0) { + delete update[key]; + } + } await this.createMotion(update); } else { await this.updateMotion(update, this.motion); @@ -582,7 +591,9 @@ export class MotionFormComponent extends BaseMeetingComponent implements OnInit number: [ ``, isUniqueAmong(this._motionNumbersSubject, (a, b) => a === b, [``, null, undefined]) - ], + ] + }), + ...(this.canManageAgenda && { agenda_create: [``], agenda_type: [``] }) diff --git a/client/src/app/site/pages/meetings/pages/motions/services/common/motion-permission.service/motion-permission.service.ts b/client/src/app/site/pages/meetings/pages/motions/services/common/motion-permission.service/motion-permission.service.ts index 0e876d5917..74566e619a 100644 --- a/client/src/app/site/pages/meetings/pages/motions/services/common/motion-permission.service/motion-permission.service.ts +++ b/client/src/app/site/pages/meetings/pages/motions/services/common/motion-permission.service/motion-permission.service.ts @@ -55,6 +55,10 @@ export class MotionPermissionService { ); } + public canManageAgenda(): boolean { + return this.operator.hasPerms(Permission.agendaItemCanManage); + } + public canDoActionWhileDelegationEnabled(isAdditionalDelegationSettingEnabled: boolean): boolean { return !( !this.operator.isAnonymous && From 80b03ac6a3477e847d7501782794a237b165ccca Mon Sep 17 00:00:00 2001 From: Elblinator Date: Tue, 22 Oct 2024 17:09:25 +0200 Subject: [PATCH 2/2] Cear motion form for updates and creation --- .../components/motion-form/motion-form.component.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-form/components/motion-form/motion-form.component.ts b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-form/components/motion-form/motion-form.component.ts index 1a6b73cea9..8c7659ae7e 100644 --- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-form/components/motion-form/motion-form.component.ts +++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-form/components/motion-form/motion-form.component.ts @@ -211,12 +211,12 @@ export class MotionFormComponent extends BaseMeetingComponent implements OnInit public saveMotion(event?: any): () => Promise { return async () => { const update = event || this.temporaryMotion; - if (this.newMotion) { - for (const key in update) { - if (update[key] === null || update[key].length === 0) { - delete update[key]; - } + for (const key in update) { + if (update[key] === null || update[key].length === 0) { + delete update[key]; } + } + if (this.newMotion) { await this.createMotion(update); } else { await this.updateMotion(update, this.motion);