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
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-06-19 19:25:21 +0300
committerDouwe Maan <douwe@selenight.nl>2017-06-19 19:50:46 +0300
commit5e8aca215243d2eaacb0a1b744909af2b7264a32 (patch)
treede0f75c16f746c62fbe19a74514f1f9fe7beb64c /lib/gitlab/diff
parentc0c394262833a4a35e3b2f7006ba6a4e93ef80d1 (diff)
Don't display comment on unchanged line on both sides in parallel diff
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r--lib/gitlab/diff/line.rb20
-rw-r--r--lib/gitlab/diff/parallel_diff.rb20
2 files changed, 20 insertions, 20 deletions
diff --git a/lib/gitlab/diff/line.rb b/lib/gitlab/diff/line.rb
index bd52ae47e9f..2d89ccfc354 100644
--- a/lib/gitlab/diff/line.rb
+++ b/lib/gitlab/diff/line.rb
@@ -42,25 +42,25 @@ module Gitlab
end
def added?
- type == 'new' || type == 'new-nonewline'
+ %w[new new-nonewline].include?(type)
end
def removed?
- type == 'old' || type == 'old-nonewline'
- end
-
- def rich_text
- @parent_file.highlight_lines! if @parent_file && !@rich_text
-
- @rich_text
+ %w[old old-nonewline].include?(type)
end
def meta?
- type == 'match'
+ %w[match new-nonewline old-nonewline].include?(type)
end
def discussable?
- !['match', 'new-nonewline', 'old-nonewline'].include?(type)
+ !meta?
+ end
+
+ def rich_text
+ @parent_file.highlight_lines! if @parent_file && !@rich_text
+
+ @rich_text
end
def as_json(opts = nil)
diff --git a/lib/gitlab/diff/parallel_diff.rb b/lib/gitlab/diff/parallel_diff.rb
index 481536a380b..0cb26fa45c8 100644
--- a/lib/gitlab/diff/parallel_diff.rb
+++ b/lib/gitlab/diff/parallel_diff.rb
@@ -14,16 +14,7 @@ module Gitlab
lines = []
highlighted_diff_lines = diff_file.highlighted_diff_lines
highlighted_diff_lines.each do |line|
- if line.meta? || line.unchanged?
- # line in the right panel is the same as in the left one
- lines << {
- left: line,
- right: line
- }
-
- free_right_index = nil
- i += 1
- elsif line.removed?
+ if line.removed?
lines << {
left: line,
right: nil
@@ -51,6 +42,15 @@ module Gitlab
free_right_index = nil
i += 1
end
+ elsif line.meta? || line.unchanged?
+ # line in the right panel is the same as in the left one
+ lines << {
+ left: line,
+ right: line
+ }
+
+ free_right_index = nil
+ i += 1
end
end