mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(reply): no need to render deleted replies that have no children
This commit is contained in:
@@ -450,11 +450,14 @@ const PostDesktop = ({ post, roles, showAllReplies, showReplies = true }: PostPr
|
||||
!isInPendingPostView &&
|
||||
replies &&
|
||||
showReplies &&
|
||||
(showAllReplies || showOmittedReplies[cid] ? replies : replies.slice(-5)).map((reply, index) => (
|
||||
<div key={index} className={styles.replyContainer}>
|
||||
<Reply reply={reply} roles={roles} postReplyCount={replyCount} />
|
||||
</div>
|
||||
))}
|
||||
(showAllReplies || showOmittedReplies[cid] ? replies : replies.slice(-5))
|
||||
// Don't render deleted replies that have no children (replyCount = 0)
|
||||
.filter((reply) => !(reply.deleted && (reply.replyCount === 0 || !reply.replyCount)))
|
||||
.map((reply, index) => (
|
||||
<div key={index} className={styles.replyContainer}>
|
||||
<Reply reply={reply} roles={roles} postReplyCount={replyCount} />
|
||||
</div>
|
||||
))}
|
||||
{isDescription && subplebbit?.rules && subplebbit?.rules.length > 0 && (
|
||||
<div className={styles.replyContainer}>
|
||||
<Reply reply={subplebbitRulesReply} />
|
||||
|
||||
@@ -359,11 +359,14 @@ const PostMobile = ({ post, roles, showAllReplies, showReplies = true }: PostPro
|
||||
!isInPendingPostView &&
|
||||
replies &&
|
||||
showReplies &&
|
||||
(showAllReplies ? replies : replies.slice(-5)).map((reply, index) => (
|
||||
<div key={index} className={styles.replyContainer}>
|
||||
<Reply postReplyCount={replyCount} reply={reply} roles={roles} />
|
||||
</div>
|
||||
))}
|
||||
(showAllReplies ? replies : replies.slice(-5))
|
||||
// Don't render deleted replies that have no children (replyCount = 0)
|
||||
.filter((reply) => !(reply.deleted && (reply.replyCount === 0 || !reply.replyCount)))
|
||||
.map((reply, index) => (
|
||||
<div key={index} className={styles.replyContainer}>
|
||||
<Reply postReplyCount={replyCount} reply={reply} roles={roles} />
|
||||
</div>
|
||||
))}
|
||||
{showRules && (
|
||||
<div className={styles.replyContainer}>
|
||||
<Reply reply={subplebbitRulesReply} />
|
||||
|
||||
Reference in New Issue
Block a user