summaryrefslogtreecommitdiff
path: root/app/helpers/diff_helper.rb
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-09-12 19:51:44 +0200
committerMarin Jankovski <marin@gitlab.com>2014-09-12 19:51:44 +0200
commit9945e8c4244d90a0481846454355e02e80369aa2 (patch)
tree65edc9427d187ad28c2656bae03fff557842a6ca /app/helpers/diff_helper.rb
parente84861d510af63969a7ca09e4248426faf2dd345 (diff)
downloadgitlab-ce-9945e8c4244d90a0481846454355e02e80369aa2.tar.gz
Move organizing of comments to helper.
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r--app/helpers/diff_helper.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index c2ce6ed0fe4..cb50d89cba8 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -103,4 +103,18 @@ module DiffHelper
def line_comments
@line_comments ||= @line_notes.group_by(&:line_code)
end
+
+ def organize_comments(type_left, type_right, line_code_left, line_code_right)
+ comments_left = comments_right = nil
+
+ unless type_left.nil? && type_right == 'new'
+ comments_left = line_comments[line_code_left]
+ end
+
+ unless type_left.nil? && type_right.nil?
+ comments_right = line_comments[line_code_right]
+ end
+
+ [comments_left, comments_right]
+ end
end