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

View File

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