This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
src/GitHub.App/ViewModels/GitHubPane Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -52,9 +52,23 @@ async Task DoOpen()
5252 {
5353 if ( thread == null )
5454 {
55- var sha = model . Thread . IsOutdated ? model . Thread . OriginalCommitSha : model . Thread . CommitSha ;
56- var file = await session . GetFile ( RelativePath , sha ) ;
57- thread = file . InlineCommentThreads . FirstOrDefault ( t => t . Comments . Any ( c => c . Comment . Id == model . Id ) ) ;
55+ if ( model . Thread . IsOutdated )
56+ {
57+ var file = await session . GetFile ( RelativePath , model . Thread . OriginalCommitSha ) ;
58+ thread = file . InlineCommentThreads . FirstOrDefault ( t => t . Comments . Any ( c => c . Comment . Id == model . Id ) ) ;
59+ }
60+ else
61+ {
62+ var file = await session . GetFile ( RelativePath , model . Thread . CommitSha ) ;
63+ thread = file . InlineCommentThreads . FirstOrDefault ( t => t . Comments . Any ( c => c . Comment . Id == model . Id ) ) ;
64+
65+ // Fall back to opening outdated file if we can't find a line number for the comment
66+ if ( thread ? . LineNumber == - 1 )
67+ {
68+ file = await session . GetFile ( RelativePath , model . Thread . OriginalCommitSha ) ;
69+ thread = file . InlineCommentThreads . FirstOrDefault ( t => t . Comments . Any ( c => c . Comment . Id == model . Id ) ) ;
70+ }
71+ }
5872 }
5973
6074 if ( thread != null && thread . LineNumber != - 1 )
You can’t perform that action at this time.
0 commit comments