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

Show warning msg before try to delete operator #2872

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -16,6 +16,7 @@ export interface GetUserRelatedModelsUser {
motion_submitter_ids: Id[];
}[];
committees?: GetUserRelatedModelsCommittee[];
name?: string;
error?: string; // This is in case the presenter fails in an unpredicted way
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ <h2 mat-dialog-title>
<li>{{ 'Is manager' | translate }}</li>
</ul>
</ng-container>
<ng-container *ngIf="isOperator(user)">
<p class="padding-left-25">
{{ 'The account is the operator and cannot be deleted' | translate }}
</p>
</ng-container>
</ng-container>
<ng-container *ngIf="user.error">
<p class="padding-left-25">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
GetUserRelatedModelsUser
} from 'src/app/gateways/presenter';
import { ViewUser } from 'src/app/site/pages/meetings/view-models/view-user';
import { OperatorService } from 'src/app/site/services/operator.service';

interface UserDeleteDialogConfig {
toRemove: ViewUser[];
Expand Down Expand Up @@ -50,7 +51,10 @@ export class UserDeleteDialogComponent implements OnInit {

public selectedUser: GetUserRelatedModelsUser | ViewUser = null;

public constructor(@Inject(MAT_DIALOG_DATA) private data: UserDeleteDialogConfig) {}
public constructor(
@Inject(MAT_DIALOG_DATA) private data: UserDeleteDialogConfig,
private operator: OperatorService
) {}

public ngOnInit(): void {
this.selectedUser = this.toDeleteUsers[0] || this.toRemoveUsers[0];
Expand All @@ -67,4 +71,8 @@ export class UserDeleteDialogComponent implements OnInit {
public getManagedCommittees(user: GetUserRelatedModelsUser): GetUserRelatedModelsCommittee[] {
return (user.committees || []).filter(committee => committee.cml === CML.can_manage);
}

public isOperator(user: GetUserRelatedModelsUser): boolean {
return user.name == this.operator.user.name;
bastianjoel marked this conversation as resolved.
Show resolved Hide resolved
}
}