fix(post): reply quote link couldn't render in posts with link and no content

This commit is contained in:
Tom (plebeius.eth)
2024-07-22 16:10:59 +02:00
parent 7ff8af7fcd
commit ddb462b95e
3 changed files with 66 additions and 69 deletions
+2 -2
View File
@@ -341,7 +341,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
post = editedComment; post = editedComment;
} }
const { author, cid, content, link, postCid, subplebbitAddress } = post || {}; const { author, cid, link, postCid, subplebbitAddress } = post || {};
const isRouteLinkToReply = useLocation().pathname.startsWith(`/p/${subplebbitAddress}/c/${cid}`); const isRouteLinkToReply = useLocation().pathname.startsWith(`/p/${subplebbitAddress}/c/${cid}`);
const { hidden } = useHide({ cid }); const { hidden } = useHide({ cid });
@@ -356,7 +356,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
> >
<PostInfo openReplyModal={openReplyModal} post={post} postReplyCount={postReplyCount} roles={roles} /> <PostInfo openReplyModal={openReplyModal} post={post} postReplyCount={postReplyCount} roles={roles} />
{link && !hidden && isValidURL(link) && <PostMedia post={post} />} {link && !hidden && isValidURL(link) && <PostMedia post={post} />}
{content && !hidden && <PostMessage post={post} />} {!hidden && <PostMessage post={post} />}
</div> </div>
</div> </div>
); );
+2 -4
View File
@@ -185,7 +185,6 @@ const PostMessageMobile = ({ post }: PostProps) => {
); );
return ( return (
content && (
<blockquote className={`${styles.postMessage} ${!isReply && styles.clampLines}`}> <blockquote className={`${styles.postMessage} ${!isReply && styles.clampLines}`}>
{isReply && !(removed || deleted) && state !== 'failed' && isReplyingToReply && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} />} {isReply && !(removed || deleted) && state !== 'failed' && isReplyingToReply && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} />}
{removed ? ( {removed ? (
@@ -250,7 +249,6 @@ const PostMessageMobile = ({ post }: PostProps) => {
</> </>
)} )}
</blockquote> </blockquote>
)
); );
}; };
@@ -261,7 +259,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
if (editedComment) { if (editedComment) {
post = editedComment; post = editedComment;
} }
const { author, cid, content, postCid, subplebbitAddress } = post || {}; const { author, cid, postCid, subplebbitAddress } = post || {};
const isRouteLinkToReply = useLocation().pathname.startsWith(`/p/${subplebbitAddress}/c/${cid}`); const isRouteLinkToReply = useLocation().pathname.startsWith(`/p/${subplebbitAddress}/c/${cid}`);
const { hidden } = useHide({ cid }); const { hidden } = useHide({ cid });
@@ -275,7 +273,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
data-post-cid={postCid} data-post-cid={postCid}
> >
<PostInfoAndMedia openReplyModal={openReplyModal} post={post} postReplyCount={postReplyCount} roles={roles} /> <PostInfoAndMedia openReplyModal={openReplyModal} post={post} postReplyCount={postReplyCount} roles={roles} />
{content && !hidden && <PostMessageMobile post={post} />} {!hidden && <PostMessageMobile post={post} />}
<ReplyBacklinks post={reply} /> <ReplyBacklinks post={reply} />
</div> </div>
</div> </div>
@@ -4,7 +4,6 @@
border: 1px solid #aaa; border: 1px solid #aaa;
background-color: var(--avatar-background-color, white); background-color: var(--avatar-background-color, white);
margin-left: 10px; margin-left: 10px;
border-radius: 32px;
overflow: hidden; overflow: hidden;
} }