diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-01-07 19:12:30 -0200 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-01-08 12:45:19 -0200 |
commit | 8303eb8a9e5f90b4b764ff3e094c743a12b0cfe4 (patch) | |
tree | e3f003c7bb61bba962324b6aaa674d107e24bf99 /lib/gitlab/diff | |
parent | ada8ccdb579bb791a67f6d2dd865a91137e702c8 (diff) | |
download | gitlab-ce-8303eb8a9e5f90b4b764ff3e094c743a12b0cfe4.tar.gz |
Adjusts duplicated line when commenting on unfolded diff lines
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r-- | lib/gitlab/diff/lines_unfolder.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/gitlab/diff/lines_unfolder.rb b/lib/gitlab/diff/lines_unfolder.rb index 9306b7e16a2..6cf904b2b2a 100644 --- a/lib/gitlab/diff/lines_unfolder.rb +++ b/lib/gitlab/diff/lines_unfolder.rb @@ -158,9 +158,14 @@ module Gitlab from = comment_position - UNFOLD_CONTEXT_SIZE - # There's no line before the match if it's in the top-most - # position. - prev_line_number = line_before_unfold_position&.old_pos || 0 + prev_line_number = + if bottom? + last_line.old_pos + else + # There's no line before the match if it's in the top-most + # position. + line_before_unfold_position&.old_pos || 0 + end if from <= prev_line_number + 1 @generate_top_match_line = false |