An error occurred while fetching this tab.
Fix "could not find out if split diff is enabled" on commented snippet
There are no commits yet
Push commits to the source branch or add previously merged commits to review them.
Created by: lguychard
Fixes #3480 (closed)
Split diff detection, used on hover through getDiffCodePart()
, getCodeElementFromLineNumber()
, would inevitably throw an exception on PR commented snippets, because it relied on the presence of a toolbar allowing to switch between split diff / unified diff, which does not exist on PR discussions pages (commented snippets are always shown as a unified diff).
To fix this:
getDiffCodePart()
to make sure that we check for hints on the hovered element before calling isSplitDomDiff()
: https://github.com/sourcegraph/sourcegraph/commit/19c3736e8ab54565eed1467e8f1b0887bbcbd14b
isDomSplitDiff()
to an element passed as argument (either the code view itself, or an element contained in the code view), and checked for hints on the code view element, rather than checking for page-level hints: https://github.com/sourcegraph/sourcegraph/commit/c90f2ee4626b234167cb6f5684b22817471f96a9
I added fixtures for newly handled cases: pull request discussion * (GitHub.com, ghe) * (vanilla, refined GitHub).
Push commits to the source branch or add previously merged commits to review them.