fix: deactivate only active users, activate only inactive users (#3111)

This commit is contained in:
Max Peintner
2022-01-25 10:51:40 +00:00
committed by GitHub
parent 542651707a
commit 159d82ad8e
2 changed files with 11 additions and 7 deletions
@@ -104,9 +104,11 @@ export class UserTableComponent implements OnInit {
public deactivateSelectedUsers(): void {
Promise.all(
this.selection.selected.map((value) => {
return this.userService.deactivateUser(value.id);
}),
this.selection.selected
.filter((u) => u.state === UserState.USER_STATE_ACTIVE)
.map((value) => {
return this.userService.deactivateUser(value.id);
}),
)
.then(() => {
this.toast.showInfo('USER.TOAST.SELECTEDDEACTIVATED', true);
@@ -122,9 +124,11 @@ export class UserTableComponent implements OnInit {
public reactivateSelectedUsers(): void {
Promise.all(
this.selection.selected.map((value) => {
return this.userService.reactivateUser(value.id);
}),
this.selection.selected
.filter((u) => u.state === UserState.USER_STATE_INACTIVE)
.map((value) => {
return this.userService.reactivateUser(value.id);
}),
)
.then(() => {
this.toast.showInfo('USER.TOAST.SELECTEDREACTIVATED', true);