Fix Bug 68663 - Accounts: Empty info panel after changing user role

This commit is contained in:
Aleksandr Lushkin 2024-06-14 18:07:04 +02:00
parent 89c74c3cad
commit 2c56d30b66
2 changed files with 15 additions and 3 deletions

View File

@ -46,8 +46,15 @@ class SelectionStore {
} }
updateSelection = (peopleList) => { updateSelection = (peopleList) => {
const hasSelection = !!this.selection.length;
const hasBufferSelection = !!this.bufferSelection;
peopleList.some((el) => { peopleList.some((el) => {
if (el.id === this.selection[0].id) this.setSelection([el]); if (hasSelection && this.selection[0].id === el.id)
this.setSelection([el]);
if (hasBufferSelection && this.bufferSelection.id === el.id)
this.setBufferSelection(el);
}); });
}; };
@ -303,6 +310,10 @@ class SelectionStore {
return this.selection.length > 0 && this.selection.length === 1; return this.selection.length > 0 && this.selection.length === 1;
} }
get isOnlyBufferSelection() {
return !this.selection.length && !!this.bufferSelection;
}
get hasFreeUsers() { get hasFreeUsers() {
const users = this.selection.filter( const users = this.selection.filter(
(x) => x.status !== EmployeeStatus.Disabled && x.isVisitor, (x) => x.status !== EmployeeStatus.Disabled && x.isVisitor,

View File

@ -141,9 +141,10 @@ class UsersStore {
get needResetUserSelection() { get needResetUserSelection() {
const { isVisible: infoPanelVisible } = this.infoPanelStore; const { isVisible: infoPanelVisible } = this.infoPanelStore;
const { isOneUserSelection } = this.peopleStore.selectionStore; const { isOneUserSelection, isOnlyBufferSelection } =
this.peopleStore.selectionStore;
return !infoPanelVisible || !isOneUserSelection; return !infoPanelVisible || (!isOneUserSelection && !isOnlyBufferSelection);
} }
updateUserStatus = async (status, userIds) => { updateUserStatus = async (status, userIds) => {
return api.people.updateUserStatus(status, userIds).then((users) => { return api.people.updateUserStatus(status, userIds).then((users) => {