Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Fix viewing outdated comments in pull request reviews #2249

Merged
merged 5 commits into from
Mar 4, 2019

Conversation

jcansdale
Copy link
Collaborator

@jcansdale jcansdale commented Feb 28, 2019

Navigating to an outdated comment from a pull request review is currently broken. This pull request fixes that and also provides a fallback when our comment matching algorithm diverges from the one on dotcom.

What this PR does

  • Fix navigation to outdated comments
  • Open outdated file if we can't find a line number to place comment thread
  • Add logging if something goes wrong

How to test

Opening an outdated comment

  1. Open github/VisualStudio pull request 2241 on GitHub pane
  2. Click on Reviewers > jcansdale
  3. Expand Outdated comments
  4. Click on one of the outdated comment links
  5. File diff should open with file is state where comment was originally made
  6. In-line comment should appear

image

Opening comment where line positioning algorithm doesn't quite match dotcom

This example uses a comment that dotcom doesn't flag as outdated, but current our line positioning algorithm can't find a line number for it. It will fall back to showing the file as it was when the comment was originally made.

  1. Open github/VisualStudio pull request 2241 on GitHub pane
  2. Click on Reviewers > jcansdale
  3. Click on comment link under Comments
  4. File diff should open with file is state where comment was originally made
  5. In-line comment should appear
    image
  6. Click on log.Error(ex, ... and hit Enter
  7. Live file should open on same line (notice the lines starting log and operatingSystem have been swapped)
    image

What this PR doesn't do

On github.com, Outdated pull requests are clearly marked. I think we should also do this to let users know they're not looking at the latest version of the code. We could also let users know to click on the source and hit Enter to navigate to the latest version.

image

Fixes #2247

Navigate to file at commit where comment was orignally added.
In case the line matching algorithms catch us out, fall back to viewing comment on file revision when comment was made.
@jcansdale jcansdale changed the title [wip] Fix viewing outdated comments in pull request reviews Fix viewing outdated comments in pull request reviews Feb 28, 2019
@jcansdale jcansdale added the bug label Feb 28, 2019
@donokuda
Copy link
Contributor

On github.com, Outdated pull requests are clearly marked. I think we should also do this to let users know they're not looking at the latest version of the code.

I think a lightweight solution would be to add an "Outdated" badge to the parent comment. I'm not sure if it would communicate that someone isn't looking at the latest version of code, but it would at least indicate that the comment they are reading may not be presently relevant.

image

@meaghanlewis meaghanlewis requested review from meaghanlewis and removed request for meaghanlewis March 4, 2019 04:55
@jcansdale jcansdale merged commit 4b2c16c into master Mar 4, 2019
@jcansdale jcansdale deleted the fixes/2247-viewing-outdated-comments branch March 4, 2019 10:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Links to outdated comments in pull request reviews don't work
3 participants