Add review thread diff to our GitHub comments viewer#2352
Add review thread diff to our GitHub comments viewer#2352Kobzol merged 4 commits intorust-lang:masterfrom
Conversation
|
Github seems to have a logic where for non-ranged line selections, the 3 previous lines (unless they don't exist, e.g. at start of file) are also shown. Compare LHS GitHub’s native way of displaying it vs. RHS this PR: For diffs with both a
In this case, the
(on rust#153997) As further test cases, there’s a 3-line selection here (shows as only 3 lines), and a first-line-of-file case here. |
Oh I see it: the case where the |
| GitHubIssueState, GitHubIssueStateReason, GitHubIssueWithComments, GitHubReviewState, | ||
| GitHubSimplifiedAuthor, | ||
| GitHubGraphQlComment, GitHubGraphQlReactionGroup, GitHubGraphQlReview, | ||
| GitHubGraphQlReviewThread, GitHubGraphQlReviewThreadComment, GitHubIssueState, | ||
| GitHubIssueStateReason, GitHubIssueWithComments, GitHubReviewState, GitHubSimplifiedAuthor, |
There was a problem hiding this comment.
Review comment only used used as a test case in and by itself
| GitHubGraphQlComment, GitHubGraphQlReactionGroup, GitHubGraphQlReview, | ||
| GitHubGraphQlReviewThread, GitHubGraphQlReviewThreadComment, GitHubIssueState, | ||
| GitHubIssueStateReason, GitHubIssueWithComments, GitHubReviewState, GitHubSimplifiedAuthor, |
There was a problem hiding this comment.
Second review comment only used used as a test case in and by itself (different range)
|
Uhhh… these 2 ranges of my above review comments (from “-21” to ”+23” vs “+21” to “+23”) look relatively identical, considering only the currently used information of start_line: Option<usize>,
end_line: Option<usize>,in the code 😅 if I debug-print the thing. |
|
Ah!! We have |
| .sum::<usize>(); | ||
| .sum::<usize>() | ||
| + issue_with_comments.review_threads.as_ref().map_or(0, |rt| { | ||
| rt.nodes |
There was a problem hiding this comment.
View changes since this review
Another test review comment.
| .sum::<usize>() | ||
| + issue_with_comments.review_threads.as_ref().map_or(0, |rt| { | ||
| rt.nodes | ||
| .iter() |
There was a problem hiding this comment.
View changes since this review
Yet another test review comment.
|
I'm currently implementing a fix for the whole logic :-) |
|
(feel free to include my commit 8d919c8 with Urgau#1) Example screenshot of this thread itself with that fix: Another still remaining relevant bug then is that the current display seems to be collapsing spaces. This probably just needs an element (or |
cee34de to
9d99903
Compare
|
Thanks you very much @steffahn! I saw in the GraphQl documentation
I was using |
9d99903 to
56205c4
Compare
That appears to be fixing it :-) |
|
@Kobzol here are two links to test the feature locally: |
Interesting, I personally look at those annotations and I don't see how they are useful, but if you think they are useful, we can add them later. |
| utils::{immutable_headers, is_known_and_public_repo}, | ||
| }; | ||
|
|
||
| pub const STYLE_URL: &str = "/gh-comments/style@0.0.4.css"; |
There was a problem hiding this comment.
Another test case, pointing to a "removed" line
|
After hovering on a resolved/hidden review thread comment, it would be nice to change the cursor to pointer and underline the text, so make it clear that you can click on it, right now it looks like read-only text, but it actually expands once you click on it. Otherwise looks great. Though I think we're well past a point where a templating engine would really come in handy 😅 |
56205c4 to
9571ec6
Compare
|
Good point on the header not changing the cursor on hover, it's fixed. |





Current our GitHub comments viewer doesn't display the associated diff of each review thread. This PR aims to fix that by retrieving the "diff hunk" from GitHub GraphQL query and displaying the relevant lines.
Asked in #triagebot > moving "view all comments" forward @ 💬.
cc @steffahn