Merge pull request #3745 from urbit/mp/landscape/admins-only

landscape: only show 'new channel' if admin
This commit is contained in:
matildepark 2020-10-18 21:52:06 -04:00 committed by GitHub
commit 4354fdde09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,8 @@ import { getGroupFromWorkspace } from "~/logic/lib/workspace";
import { SidebarAppConfigs } from './types';
import { SidebarList } from "./SidebarList";
import { SidebarInvite } from './SidebarInvite';
import { roleForShip } from "~/logic/lib/group";
interface SidebarProps {
children: ReactNode;
@ -89,6 +91,14 @@ export function Sidebar(props: SidebarProps) {
);
const sidebarInvites = (workspace?.type === 'home')
? inviteItems(invites, api) : null;
const role = props.groups?.[groupPath] ? roleForShip(props.groups[groupPath], window.ship) : undefined;
const isAdmin = (role === "admin") || (workspace?.type === 'home');
const newStyle = {
display: isAdmin ? "block" : "none"
};
return (
<Col
display={display}
@ -131,6 +141,7 @@ export function Sidebar(props: SidebarProps) {
py="2"
>
<Link
style={newStyle}
to={!!groupPath ? `/~landscape${groupPath}/new` : `/~landscape/home/new`}
>
<Box