diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-07-21 01:18:18 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-07-21 01:18:18 +0300 |
commit | 79214be727aaa0704a1be5b50aa6dd3011629bc2 (patch) | |
tree | 8be3ad3775acebb43b114cd90a8fc919097a7b2c /app/helpers/diff_helper.rb | |
parent | 5a77eb153669bfbac4ab1f05615d11965beb826d (diff) |
Add Discussion model to represent MR/diff discussion
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r-- | app/helpers/diff_helper.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 75b029365f9..4c031942793 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -54,18 +54,20 @@ module DiffHelper end end - def organize_comments(left, right) - notes_left = notes_right = nil + def parallel_diff_discussions(left, right, diff_file) + discussion_left = discussion_right = nil - unless left[:type].nil? && right[:type] == 'new' - notes_left = @grouped_diff_notes[left[:line_code]] + if left && (left.unchanged? || left.removed?) + line_code = diff_file.line_code(left) + discussion_left = @grouped_diff_discussions[line_code] end - unless left[:type].nil? && right[:type].nil? - notes_right = @grouped_diff_notes[right[:line_code]] + if right && right.added? + line_code = diff_file.line_code(right) + discussion_right = @grouped_diff_discussions[line_code] end - [notes_left, notes_right] + [discussion_left, discussion_right] end def inline_diff_btn |