mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post): reply quote link couldn't render in posts with link and no content
This commit is contained in:
@@ -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>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -185,72 +185,70 @@ 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 ? (
|
<Tooltip
|
||||||
|
children={<span className={styles.removedContent}>({t('this_post_was_removed')})</span>}
|
||||||
|
content={`${_.capitalize(t('reason'))}: "${reason}"`}
|
||||||
|
showTooltip={!!reason}
|
||||||
|
/>
|
||||||
|
) : deleted ? (
|
||||||
|
<Tooltip children={<span className={styles.deletedContent}>{t('user_deleted_this_post')}</span>} content={reason && `${t('reason')}: ${reason}`} />
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{!showOriginal && <Markdown content={displayContent} />}
|
||||||
|
{edit && original?.content !== post?.content && (
|
||||||
|
<span className={styles.editedInfo}>
|
||||||
|
{showOriginal && <Markdown content={original?.content} />}
|
||||||
|
<br />
|
||||||
|
{t('comment_edited_at_timestamp', { timestamp: getFormattedDate(edit?.timestamp), interpolation: { escapeValue: false } })}{' '}
|
||||||
|
{reason && <>{t('reason_reason', { reason: reason, interpolation: { escapeValue: false } })} </>}
|
||||||
|
{showOriginal ? (
|
||||||
|
<Trans
|
||||||
|
i18nKey={'click_here_to_hide_original'}
|
||||||
|
shouldUnescape={true}
|
||||||
|
components={{ 1: <span className={styles.showOriginal} onClick={() => setShowOriginal(!showOriginal)} /> }}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Trans
|
||||||
|
i18nKey={'click_here_to_show_original'}
|
||||||
|
shouldUnescape={true}
|
||||||
|
components={{ 1: <span className={styles.showOriginal} onClick={() => setShowOriginal(!showOriginal)} /> }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{/* TODO: commentAuthor is not available outside of editedComment, update when available */}
|
||||||
|
{/* {banned && (
|
||||||
|
<span className={styles.removedContent}>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
<Tooltip
|
<Tooltip
|
||||||
children={<span className={styles.removedContent}>({t('this_post_was_removed')})</span>}
|
children={`(${t('user_banned')})`}
|
||||||
content={`${_.capitalize(t('reason'))}: "${reason}"`}
|
content={`${t('ban_expires_at', {
|
||||||
showTooltip={!!reason}
|
address: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress),
|
||||||
|
timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
|
||||||
|
interpolation: { escapeValue: false },
|
||||||
|
})}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`}
|
||||||
/>
|
/>
|
||||||
) : deleted ? (
|
</span>
|
||||||
<Tooltip children={<span className={styles.deletedContent}>{t('user_deleted_this_post')}</span>} content={reason && `${t('reason')}: ${reason}`} />
|
)} */}
|
||||||
) : (
|
{!isReply && content.length > 1000 && !isInPostView && (
|
||||||
<>
|
<span className={styles.abbr}>
|
||||||
{!showOriginal && <Markdown content={displayContent} />}
|
<br />
|
||||||
{edit && original?.content !== post?.content && (
|
<Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <Link to={`/p/${subplebbitAddress}/c/${cid}`} /> }} />
|
||||||
<span className={styles.editedInfo}>
|
</span>
|
||||||
{showOriginal && <Markdown content={original?.content} />}
|
)}
|
||||||
<br />
|
{!cid && state === 'pending' && stateString !== 'Failed' && (
|
||||||
{t('comment_edited_at_timestamp', { timestamp: getFormattedDate(edit?.timestamp), interpolation: { escapeValue: false } })}{' '}
|
<>
|
||||||
{reason && <>{t('reason_reason', { reason: reason, interpolation: { escapeValue: false } })} </>}
|
<br />
|
||||||
{showOriginal ? (
|
{loadingString}
|
||||||
<Trans
|
</>
|
||||||
i18nKey={'click_here_to_hide_original'}
|
)}
|
||||||
shouldUnescape={true}
|
</blockquote>
|
||||||
components={{ 1: <span className={styles.showOriginal} onClick={() => setShowOriginal(!showOriginal)} /> }}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Trans
|
|
||||||
i18nKey={'click_here_to_show_original'}
|
|
||||||
shouldUnescape={true}
|
|
||||||
components={{ 1: <span className={styles.showOriginal} onClick={() => setShowOriginal(!showOriginal)} /> }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{/* TODO: commentAuthor is not available outside of editedComment, update when available */}
|
|
||||||
{/* {banned && (
|
|
||||||
<span className={styles.removedContent}>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<Tooltip
|
|
||||||
children={`(${t('user_banned')})`}
|
|
||||||
content={`${t('ban_expires_at', {
|
|
||||||
address: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress),
|
|
||||||
timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
|
|
||||||
interpolation: { escapeValue: false },
|
|
||||||
})}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
)} */}
|
|
||||||
{!isReply && content.length > 1000 && !isInPostView && (
|
|
||||||
<span className={styles.abbr}>
|
|
||||||
<br />
|
|
||||||
<Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <Link to={`/p/${subplebbitAddress}/c/${cid}`} /> }} />
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
{!cid && state === 'pending' && stateString !== 'Failed' && (
|
|
||||||
<>
|
|
||||||
<br />
|
|
||||||
{loadingString}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user