-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix preview-hidden-comments on review comments
#4915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| const comment = select('.comment-body', details); | ||
| /* Review comments are loaded asynchronously */ | ||
| if (!comment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of checking if each details contains a .comment-body, it'd be more efficient to select those and then use .closest('details').
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a note on hidden review comments: they're not loaded with the page, but only when first expanded... except when the link has a hash pointing to a review comment in the same discussion:
- this will load the hidden comments: Add
comment-on-draft-pr-indicatorfeature #4520 (comment) - this will not: Add
comment-on-draft-pr-indicatorfeature #4520
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a note on hidden review comments: they're not loaded with the page, but only when first expanded... except when the link has a hash pointing to a review comment in the same discussion:
In that case it's no longer hidden, which we don't care about.
If they're all hidden, then they should just be excluded, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case it's no longer hidden, which we don't care about.
Just to be perfectly clear: hidden review comments do get loaded without needing to be opened first (meaning they can be previewed), but only when focusing another review comment in the same subthread (e.g. when following a link ending with #discussion_r<id>).
In all other cases the feature would be almost useless, since the comments need to be loaded first by opening them. (One could argue that it might be useful to be able to preview comments that have been opened up and then hidden again, if there's a lot of them.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the JS comment with this information? It makes it sounds like all review comments are to be excluded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of checking if each
detailscontains a.comment-body, it'd be more efficient to select those directly and then use.closest('details')
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of checking if each
detailscontains a.comment-body, it'd be more efficient to select those and then use.closest('details').
Yes 👍
|
Unrelated but I just noticed hiding review comments doesn't work anymore. This is a GitHub bug btw 🤦 |
preview-hidden-comments feature on review commentspreview-hidden-comments on review comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

Fixes #4524
Test URLs
Screenshot
Before

After
