chore: Serialize domain policies on team (#1970)

* domain policies exposed on team, consistency

* fix: Remove usage of isAdmin in frontend

* test
This commit is contained in:
Tom Moor
2021-03-22 20:50:12 -07:00
committed by GitHub
parent b3353f20d5
commit 349e971a8a
26 changed files with 258 additions and 145 deletions

View File

@ -14,9 +14,10 @@ type Props = {|
|};
function UserMenu({ user }: Props) {
const { users } = useStores();
const { users, policies } = useStores();
const { t } = useTranslation();
const menu = useMenuState({ modal: true });
const can = policies.abilities(user.id);
const handlePromote = React.useCallback(
(ev: SyntheticEvent<>) => {
@ -98,14 +99,14 @@ function UserMenu({ user }: Props) {
userName: user.name,
}),
onClick: handleDemote,
visible: user.isAdmin,
visible: can.demote,
},
{
title: t("Make {{ userName }} an admin…", {
userName: user.name,
}),
onClick: handlePromote,
visible: !user.isAdmin && !user.isSuspended,
visible: can.promote,
},
{
type: "separator",