Merge pull request #4411 from urbit/la/link-perm

interface: don't show link submit when empty collection and we don't have permission
This commit is contained in:
L 2021-02-10 16:20:37 -06:00 committed by GitHub
commit 22da150305
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -9,7 +9,6 @@ import { uxToHex } from '~/logic/lib/util';
import { RouteComponentProps } from "react-router-dom"; import { RouteComponentProps } from "react-router-dom";
import { LinkItem } from "./components/LinkItem"; import { LinkItem } from "./components/LinkItem";
import LinkSubmit from "./components/LinkSubmit";
import { LinkPreview } from "./components/link-preview"; import { LinkPreview } from "./components/link-preview";
import { LinkWindow } from "./LinkWindow"; import { LinkWindow } from "./LinkWindow";
import { Comments } from "~/views/components/Comments"; import { Comments } from "~/views/components/Comments";
@ -50,6 +49,7 @@ export function LinkResource(props: LinkResourceProps) {
: { metadata: {} }; : { metadata: {} };
const contactDetails = contacts[resource?.group] || {}; const contactDetails = contacts[resource?.group] || {};
const group = groups[resource?.group] || {}; const group = groups[resource?.group] || {};
const graph = graphs[resourcePath] || null; const graph = graphs[resourcePath] || null;
useEffect(() => { useEffect(() => {

View File

@ -63,9 +63,14 @@ export function LinkWindow(props: LinkWindowProps) {
if (!first) { if (!first) {
return ( return (
<Col key={0} mx="auto" mt="4" maxWidth="768px" width="100%" flexShrink={0} px={3}> <Col key={0} mx="auto" mt="4" maxWidth="768px" width="100%" flexShrink={0} px={3}>
{ canWrite ? (
<LinkSubmit s3={props.s3} name={name} ship={ship.slice(1)} api={api} /> <LinkSubmit s3={props.s3} name={name} ship={ship.slice(1)} api={api} />
</Col> ) : (
<Text>There are no links here yet. You do not have permission to post to this collection.</Text>
)
}
</Col>
); );
} }