From 563c1ca01cf94e125a5d01669e6e8455da257246 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Tue, 30 May 2017 23:38:06 +0300 Subject: Fix: A diff comment on a change at last line of a file shows as two comments in discussion --- app/helpers/diff_helper.rb | 4 ++-- app/views/projects/diffs/_line.html.haml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 4c4fbdd4d39..5f3897b4f40 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -66,12 +66,12 @@ module DiffHelper discussions_left = discussions_right = nil - if left && (left.unchanged? || left.removed?) + if left && (left.unchanged? || left.discussable?) line_code = diff_file.line_code(left) discussions_left = @grouped_diff_discussions[line_code] end - if right && right.added? + if right&.discussable? line_code = diff_file.line_code(right) discussions_right = @grouped_diff_discussions[line_code] end diff --git a/app/views/projects/diffs/_line.html.haml b/app/views/projects/diffs/_line.html.haml index 7439b8a66f7..43708d22a0c 100644 --- a/app/views/projects/diffs/_line.html.haml +++ b/app/views/projects/diffs/_line.html.haml @@ -3,7 +3,7 @@ - discussions = local_assigns.fetch(:discussions, nil) - type = line.type - line_code = diff_file.line_code(line) -- if discussions && !line.meta? +- if discussions && line.discussable? - line_discussions = discussions[line_code] %tr.line_holder{ class: type, id: (line_code unless plain) } - case type -- cgit v1.2.3