summaryrefslogtreecommitdiff
path: root/app/helpers/diff_helper.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-05-10 17:41:46 -0500
committerDouwe Maan <douwe@selenight.nl>2016-05-13 17:31:43 -0500
commit99d3e21f19ffb5cccb58fdfeac4fb6174e7e65e2 (patch)
tree3dae33d98b9688a3f7e9a4c923f555920d86652b /app/helpers/diff_helper.rb
parent5e130c3e39febcd577e61ebd30bd231827d41f2c (diff)
downloadgitlab-ce-99d3e21f19ffb5cccb58fdfeac4fb6174e7e65e2.tar.gz
Extract LegacyDiffNote out of Note
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r--app/helpers/diff_helper.rb22
1 files changed, 9 insertions, 13 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index 9f73edb4553..5f311f3780a 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -55,22 +55,18 @@ module DiffHelper
end
end
- def line_comments
- @line_comments ||= @line_notes.select(&:active?).sort_by(&:created_at).group_by(&:line_code)
- end
-
- def organize_comments(type_left, type_right, line_code_left, line_code_right)
- comments_left = comments_right = nil
+ def organize_comments(left, right)
+ notes_left = notes_right = nil
- unless type_left.nil? && type_right == 'new'
- comments_left = line_comments[line_code_left]
+ unless left[:type].nil? && right[:type] == 'new'
+ notes_left = @grouped_diff_notes[left[:line_code]]
end
- unless type_left.nil? && type_right.nil?
- comments_right = line_comments[line_code_right]
+ unless left[:type].nil? && right[:type].nil?
+ notes_right = @grouped_diff_notes[right[:line_code]]
end
- [comments_left, comments_right]
+ [notes_left, notes_right]
end
def inline_diff_btn
@@ -96,8 +92,8 @@ module DiffHelper
].join(' ').html_safe
end
- def commit_for_diff(diff)
- if diff.deleted_file
+ def commit_for_diff(diff_file)
+ if diff_file.deleted_file
@base_commit || @commit.parent || @commit
else
@commit