feat: collapse downvoted comments by default when setting (default off) is set#1860
feat: collapse downvoted comments by default when setting (default off) is set#1860jameslounds wants to merge 5 commits intoaeharding:mainfrom
Conversation
This reverts commit c1b5630.
aeharding
left a comment
There was a problem hiding this comment.
Thanks for the PR! I tried it out. I really like it, seems to clean up the comments section a good amount.
However, I did find a bug: The first time I tap to expand an auto collapsed comment, it doesn't expand. It does on the second try, though.
LMK if you have any questions I'm happy to help
| }: CommentTreeProps) { | ||
| const dispatch = useAppDispatch(); | ||
| const commentId = comment.comment_view.comment.id; | ||
| const hasUserCollapsed = useAppSelector((state) => |
There was a problem hiding this comment.
Remove this selector and check if collapsed == null
| (state) => state.settings.general.comments.downvotedCollapsedByDefault, | ||
| ); | ||
|
|
||
| const isDownvoted = |
There was a problem hiding this comment.
Check if counts.score < 0 instead
| dispatch(setDownvotedCollapsedByDefault(e.detail.checked)) | ||
| } | ||
| > | ||
| Collapse Downvoted Comments |
There was a problem hiding this comment.
I was initially confused by this! I thought it would collapse when I downvote. Instead, it collapses comments with negative cumulative vote (which makes more sense!).
I think we should come up with a different setting that avoids this confusion. Some options...
as a switch, "Auto Collapse Negative Votes"
or, as a dropdown with options:
"Collapse Downvoted Comments..."
- "When Negative"
- "When Highly Downvoted" (some cool algorithm we build hehe)
- "Never" (default)
I personally prefer the latter, and it opens the door for more customization. What are your thoughts?
| general: { | ||
| comments: { | ||
| collapseCommentThreads: OCommentThreadCollapse.Never, | ||
| downvotedCollapsedByDefault: false, |
12e8b8c to
4efb2fc
Compare
Closes #1838
This is my first contribution, so it's very possible I've misunderstood something or not followed conventions in the project. As well as more substantive feedback, nitpicks are more than welcome - they help me learn!
About the `ppm-lcck.yaml` update (reverted)
Also not entirely sure why, but the
pnpm-lock.yamlneeded updating.pnpm i --frozen-lockfilegave an errorIt seems that the CI won't pass with my updated lockfile (with the same error I get using the
mainlockfile).The setting is off by default.
I've added
hasUserCollapsedwhich is true if the value forcommentIdinstate.comment.commentCollapsedByIdhas been defined. If it hasn't we're in the initial state of the comment (uncollapsed unless downvoted & setting is set). If it has, the user must have shown/hidden the comment so we should use the state fromstate.comment.commentCollapsedByIdrather than the default.