diff --git a/pkg/interface/src/views/landscape/components/Home/GroupFeed.js b/pkg/interface/src/views/landscape/components/Home/GroupFeed.js index 65fab66ac..872cb63d4 100644 --- a/pkg/interface/src/views/landscape/components/Home/GroupFeed.js +++ b/pkg/interface/src/views/landscape/components/Home/GroupFeed.js @@ -24,7 +24,6 @@ function GroupFeed(props) { vip } = props; - console.log(vip); const groups = useGroupState(state => state.groups); const group = groups[groupPath]; @@ -63,6 +62,7 @@ function GroupFeed(props) { baseUrl={baseUrl} history={history} graphs={graphs} + vip={vip} graphResource={graphResource} /> { if (!graph) { return null; @@ -38,6 +37,10 @@ export function GroupFeedHeader(props) { authorText = node.post.author; } + const permText = ( + vip === 'reader-comments' + ) ? 'Select ships can post' : 'Everyone can post'; + return ( Group Feed - Everyone can post + {permText} ) : ( !authorText ? null : ( <> diff --git a/pkg/interface/src/views/landscape/components/Home/GroupHome.js b/pkg/interface/src/views/landscape/components/Home/GroupHome.js index 0e34875ab..f1137a693 100644 --- a/pkg/interface/src/views/landscape/components/Home/GroupHome.js +++ b/pkg/interface/src/views/landscape/components/Home/GroupHome.js @@ -22,6 +22,7 @@ function GroupHome(props) { const groups = useGroupState(state => state.groups); const metadata = associations?.groups[groupPath]?.metadata; + const askFeedBanner = metadata && metadata.config && @@ -35,6 +36,7 @@ function GroupHome(props) { 'resource' in metadata.config.group; const graphPath = metadata?.config?.group?.resource; + const graphMetadata = associations?.graph[graphPath]?.metadata; return ( @@ -60,7 +62,7 @@ function GroupHome(props) { diff --git a/pkg/interface/src/views/landscape/components/Home/Post/PostFeed.js b/pkg/interface/src/views/landscape/components/Home/Post/PostFeed.js index 632fb0b6c..56cc51e43 100644 --- a/pkg/interface/src/views/landscape/components/Home/Post/PostFeed.js +++ b/pkg/interface/src/views/landscape/components/Home/Post/PostFeed.js @@ -24,6 +24,7 @@ export class PostFeed extends React.Component { baseUrl, parentNode, association, + group, vip } = this.props; const graphResource = resourceFromPath(graphPath); @@ -61,6 +62,7 @@ export class PostFeed extends React.Component { isParent={true} isRelativeTime={false} vip={vip} + group={group} /> ); @@ -96,6 +99,7 @@ export class PostFeed extends React.Component { isReply={!!parentNode} isRelativeTime={true} vip={vip} + group={group} /> ); }); diff --git a/pkg/interface/src/views/landscape/components/Home/Post/PostInput.js b/pkg/interface/src/views/landscape/components/Home/Post/PostInput.js index f73c5576a..dff2abd30 100644 --- a/pkg/interface/src/views/landscape/components/Home/Post/PostInput.js +++ b/pkg/interface/src/views/landscape/components/Home/Post/PostInput.js @@ -9,9 +9,22 @@ import { createPost } from '~/logic/api/graph'; import useStorage from '~/logic/lib/useStorage'; import { resourceFromPath, isWriter } from '~/logic/lib/group'; +function canWrite(props) { + const { group, association, vip, index } = props; + if (vip === '') { + return true; + } + + if (!!index) { + return true; + } + + return isWriter(group, association.resource); +} + export function PostInput(props) { - const { api, graphPath, index, submitCallback } = props; + const { api, graphPath, index, submitCallback, vip } = props; const graphResource = resourceFromPath(graphPath); const [disabled, setDisabled] = useState(false); @@ -73,6 +86,11 @@ export function PostInput(props) { }); }; + + if (!(canWrite(props))) { + return null; + } + return ( + { showTimestamp && ( 0) { + return true; + } + return isWriter(group, association.resource); } @@ -58,6 +73,8 @@ class PostItem extends React.Component { isReply, isRelativeTime, parentPost, + vip, + group, hovering, bind } = this.props; @@ -71,6 +88,8 @@ class PostItem extends React.Component { const { inReplyMode } = this.state; + const canComment = this.canWrite(); + return ( { inReplyMode ? ( @@ -124,8 +144,10 @@ class PostItem extends React.Component { ) : null } diff --git a/pkg/interface/src/views/landscape/components/Home/Post/PostReplies.js b/pkg/interface/src/views/landscape/components/Home/Post/PostReplies.js index a110287fc..b2fe93d12 100644 --- a/pkg/interface/src/views/landscape/components/Home/Post/PostReplies.js +++ b/pkg/interface/src/views/landscape/components/Home/Post/PostReplies.js @@ -1,7 +1,6 @@ import React from 'react'; import bigInt from 'big-integer'; import { Text, Col, Box } from '@tlon/indigo-react' -import { PostInput } from './PostInput'; import PostItem from './PostItem/PostItem'; import { PostFeed } from './PostFeed'; import { Loading } from '~/views/components/Loading'; @@ -77,6 +76,7 @@ export default function PostReplies(props) { history={history} isParent={true} vip={vip} + group={group} /> - +