Commit de872f26 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'rs-note-reuse-for-methods' into 'master'

Make better use of the `Note#for_*?` methods

We've got all these polymorphic type-checking methods, might as well use
'em everywhere it makes sense.

See merge request !3106
parents 20ed08ed dcbf7d13
...@@ -87,7 +87,7 @@ class Note < ActiveRecord::Base ...@@ -87,7 +87,7 @@ class Note < ActiveRecord::Base
next if discussion_ids.include?(note.discussion_id) next if discussion_ids.include?(note.discussion_id)
# don't group notes for the main target # don't group notes for the main target
if !note.for_diff_line? && note.noteable_type == "MergeRequest" if !note.for_diff_line? && note.for_merge_request?
discussions << [note] discussions << [note]
else else
discussions << notes.select do |other_note| discussions << notes.select do |other_note|
...@@ -375,7 +375,7 @@ class Note < ActiveRecord::Base ...@@ -375,7 +375,7 @@ class Note < ActiveRecord::Base
private private
def awards_supported? def awards_supported?
(noteable.kind_of?(Issue) || noteable.is_a?(MergeRequest)) && !for_diff_line? (for_issue? || for_merge_request?) && !for_diff_line?
end end
def contains_emoji_only? def contains_emoji_only?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment