Merge pull request #5957 from CatoTH/bugfix/add-warning-when-editing-motion-with-amendments

Add a warning when editing a motion with existing amendments
This commit is contained in:
Emanuel Schütze 2021-03-22 21:15:02 +01:00 committed by GitHub
commit 2e5cea512e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -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
*/