mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-10 00:33:10 +00:00
fix: forum stats render according to moderation toggle
This commit is contained in:
parent
684cb119e8
commit
af75b5eef4
@ -303,10 +303,17 @@ export function useForumData(): ForumData {
|
||||
}, [postsWithVoteStatus, showModerated]);
|
||||
|
||||
const filteredComments = useMemo(() => {
|
||||
return showModerated
|
||||
? commentsWithVoteStatus
|
||||
: commentsWithVoteStatus.filter(comment => !comment.moderated);
|
||||
}, [commentsWithVoteStatus, showModerated]);
|
||||
if (showModerated) return commentsWithVoteStatus;
|
||||
|
||||
// Hide moderated comments AND comments whose parent post is moderated
|
||||
const moderatedPostIds = new Set(
|
||||
postsWithVoteStatus.filter(p => p.moderated).map(p => p.id)
|
||||
);
|
||||
|
||||
return commentsWithVoteStatus.filter(
|
||||
comment => !comment.moderated && !moderatedPostIds.has(comment.postId)
|
||||
);
|
||||
}, [commentsWithVoteStatus, postsWithVoteStatus, showModerated]);
|
||||
|
||||
// Filtered cells with stats based on filtered posts
|
||||
const filteredCellsWithStats = useMemo((): CellWithStats[] => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user