groups: only surface invite if admin

Fixes #3803.
This commit is contained in:
Matilde Park 2020-10-30 16:28:47 -04:00
parent bef97699e2
commit 5c84ba514f
2 changed files with 7 additions and 6 deletions

View File

@ -77,7 +77,7 @@ export function GroupSwitcher(props: {
baseUrl: string;
recentGroups: string[];
}) {
const { associations, workspace } = props;
const { associations, workspace, isAdmin } = props;
const title = getTitleFromWorkspace(associations, workspace);
const navTo = (to: string) => `${props.baseUrl}${to}`;
return (
@ -152,14 +152,14 @@ export function GroupSwitcher(props: {
/>
<Text> Group Settings</Text>
</GroupSwitcherItem>
<GroupSwitcherItem bottom to={navTo("/invites")}>
{isAdmin && (<GroupSwitcherItem bottom to={navTo("/invites")}>
<Icon
mr={2}
color="blue"
icon="Users"
/>
<Text color="blue">Invite to group</Text>
</GroupSwitcherItem>
</GroupSwitcherItem>)}
</>
)}
</Col>
@ -173,15 +173,15 @@ export function GroupSwitcher(props: {
</Row>
</Dropdown>
<Row pr={1} justifyContent="flex-end" alignItems="center">
{workspace.type === "group" && (
{(workspace.type === "group") && (
<>
<Link to={navTo("/invites")}>
{isAdmin && (<Link to={navTo("/invites")}>
<Icon
display="block"
color='blue'
icon="Users"
/>
</Link>
</Link>)}
<Link to={navTo("/popover/settings")}>
<Icon color='gray' display="block" m={2} icon="Gear" />
</Link>

View File

@ -119,6 +119,7 @@ export function Sidebar(props: SidebarProps) {
associations={associations}
recentGroups={props.recentGroups}
baseUrl={props.baseUrl}
isAdmin={isAdmin}
workspace={props.workspace}
/>
<SidebarListHeader