web: People: Added isUserDisabled selector

This commit is contained in:
Alexey Safronov 2019-08-06 12:44:32 +03:00
parent f9fe6c800b
commit 217b5f0bed
2 changed files with 38 additions and 30 deletions

View File

@ -5,7 +5,7 @@ import { ContentRow, toastr } from "asc-web-components";
import UserContent from "./userContent";
//import config from "../../../../../../package.json";
import { selectUser, deselectUser, setSelection } from "../../../../../store/people/actions";
import { isSelected, getUserStatus, getUserRole } from '../../../../../store/people/selectors';
import { isSelected, getUserStatus, getUserRole, isUserDisabled } from '../../../../../store/people/selectors';
import { isAdmin } from '../../../../../store/auth/selectors';
class SectionBodyContent extends React.PureComponent {
@ -36,8 +36,8 @@ class SectionBodyContent extends React.PureComponent {
}
getUserContextOptions = (user) => {
return [
{
const options = [{
key: "key1",
label: "Send e-mail",
onClick: this.onEmailSentClick
@ -62,12 +62,16 @@ class SectionBodyContent extends React.PureComponent {
key: "key6",
label: "Change e-mail",
onClick: this.onChangeEmailClick
},
{
}];
return [...options,
!isUserDisabled(user)
? {
key: "key7",
label: "Disable",
onClick: this.onDisableClick
}
: {}
];
};

View File

@ -122,4 +122,8 @@ export function getUsersBySelected(users, selected) {
});
return newSelection;
}
};
export function isUserDisabled(user) {
return getUserStatus(user) === "disabled";
};