Post: show reply if main post

This commit is contained in:
Liam Fitzgerald 2021-04-02 10:34:14 +10:00
parent 86fd281bd0
commit d14b4ea471
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
3 changed files with 11 additions and 3 deletions

View File

@ -23,6 +23,7 @@ export class PostFeed extends React.Component {
history,
baseUrl,
parentNode,
grandparentNode,
association,
group,
vip
@ -52,7 +53,9 @@ export class PostFeed extends React.Component {
<PostItem
key={parentNode.post.index}
ref={ref}
parentPost={grandparentNode?.post}
node={parentNode}
parentNode={grandparentNode}
graphPath={graphPath}
association={association}
api={api}

View File

@ -114,10 +114,10 @@ class PostItem extends React.Component {
association={association}
showTimestamp={isRelativeTime}
isReply={isReply} />
{ isReply ? (
{ (isReply || (parentPost && index.length > 1 && isParent)) ? (
<Row width="100%" alignItems="center" mb="2" pl="2" pr="2">
<Text color="gray" pr="1">Replying to</Text>
<Mention ship={parentPost.author} />
<Mention ship={parentPost?.author} />
</Row>
) : null }
<PostContent

View File

@ -41,11 +41,15 @@ export default function PostReplies(props) {
});
let node;
nodeIndex.forEach((i) => {
let parentNode;
nodeIndex.forEach((i, idx) => {
if (!graph) {
return null;
}
node = graph.get(i);
if(idx < nodeIndex.length - 1) {
parentNode = node;
}
if (!node) {
return null;
}
@ -101,6 +105,7 @@ export default function PostReplies(props) {
key={locationUrl}
graphPath={graphPath}
graph={graph}
grandparentNode={parentNode}
parentNode={node}
pendingSize={pendingSize}
association={association}