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:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-01-08 18:48:08 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-01-08 18:48:08 +0300
commit22ab2d040d2145dd69eb1f323188ef5979ecba63 (patch)
treecfc51c66e0be206dd06984684316e0318005202c /lib
parent5106f88a480ab02c3502431cbf636b90348591af (diff)
parent8303eb8a9e5f90b4b764ff3e094c743a12b0cfe4 (diff)
Merge branch 'osw-fix-bottom-expansion-diff-comment' into 'master'
Adjusts duplicated line when commenting on unfolded diff lines (in the bottom) Closes #56051 See merge request gitlab-org/gitlab-ce!24201
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