From 9c2e49692cacee520cc4420fe4331ebdaf3a7bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Ho=CC=88=C3=9Fl?= Date: Sun, 14 Mar 2021 19:50:52 +0100 Subject: [PATCH] Add a warning when editing a motion with existing amendments --- .../motion-detail/motion-detail.component.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 b0003fec4..01c7dc8b0 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 @@ -1376,6 +1376,7 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements this.patchForm(this.motion); this.editNotificationSubscription = this.listenToEditNotification(); this.sendEditNotification(MotionEditNotificationType.TYPE_BEGIN_EDITING_MOTION); + this.showMotionEditConflictWarningIfNecessary(); } if (!mode && this.newMotion) { this.router.navigate(['./motions/']); @@ -1387,6 +1388,15 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements } } + public showMotionEditConflictWarningIfNecessary(): void { + if (this.amendments?.filter(amend => amend.isParagraphBasedAmendment()).length > 0) { + const msg = this.translate.instant( + 'Warning: Amendments exist for this motion. Editing this text will likely impact them negatively. Particularily, amendments might become unusable if the paragraph they affect is deleted.' + ); + this.raiseWarning(msg); + } + } + /** * Sets the default workflow ID during form creation */