Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix motion-with-amendment dialog #2818

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ export class MotionMultiselectService {
* @param motions The motions to delete
*/
public async delete(motions: ViewMotion[]): Promise<void> {
const title = this.translate.instant(`Are you sure you want to delete all selected motions?`);
let title = this.translate.instant(`Are you sure you want to delete all selected motions?`);
if (motions.some(motion => motion.amendments?.length)) {
title = this.translate.instant(
`Warning: Amendments exist for at least one of the selected motions. Are you sure you want to delete these motions regardless?`
);
}
if (await this.promptService.open(title)) {
const message = `${motions.length} ${this.translate.instant(this.messageForSpinner)}`;
this.spinnerService.show(message, { hideAfterPromiseResolved: () => this.repo.delete(...motions) });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,20 @@ export class MotionDetailViewComponent extends BaseMeetingComponent implements O
* Trigger to delete the motion.
*/
public async deleteMotionButton(): Promise<void> {
const title = this.translate.instant(`Are you sure you want to delete this motion?`);
const content = this.motion.getTitle();
let title = this.translate.instant(`Are you sure you want to delete this motion? `);
let content = this.motion.getTitle();
if (this.motion.amendments.length) {
title = this.translate.instant(
`Warning: Amendments exist for this motion. Are you sure you want to delete this motion regardless?`
);
content =
this.translate.instant(`Motion: `) +
this.motion.getTitle() +
this.translate.instant(
`. Deleting this motion will likely impact it's amendments negatively and they could become unusable. List of amendments: `
) +
this.motion.amendments;
}
if (await this.promptService.open(title, content)) {
await this.repo.delete(this.motion);
this.router.navigate([this.activeMeetingId, `motions`]);
Expand Down