Commit cb04023e authored by Kerri Miller's avatar Kerri Miller

Merge branch 'ph/fixOutdatedDiffLinesStartingIndex' into 'master'

Fixed outdated diff line service finding wrong diff line index

See merge request gitlab-org/gitlab!74389
parents b0db5779 1164e008
......@@ -15,7 +15,13 @@ module MergeRequests
def execute
end_position = position.line_range["end"]
diff_line_index = diff_lines.find_index { |l| l.new_line == end_position["new_line"] || l.old_line == end_position["old_line"] }
diff_line_index = diff_lines.find_index do |l|
if end_position["new_line"]
l.new_line == end_position["new_line"]
elsif end_position["old_line"]
l.old_line == end_position["old_line"]
end
end
initial_line_index = [diff_line_index - OVERFLOW_LINES_COUNT, 0].max
last_line_index = [diff_line_index + OVERFLOW_LINES_COUNT, diff_lines.length].min
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment