Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2019-01-08 00:12:30 +0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2019-01-08 17:45:19 +0300
commit8303eb8a9e5f90b4b764ff3e094c743a12b0cfe4 (patch)
treee3f003c7bb61bba962324b6aaa674d107e24bf99 /lib
parentada8ccdb579bb791a67f6d2dd865a91137e702c8 (diff)
Adjusts duplicated line when commenting on unfolded diff lines
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/diff/lines_unfolder.rb11
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