Commit ba4f0abf47940f27160166500979f6bcbd797d45

Authored by Dmitriy Zaporozhets
1 parent b1bd3f12

wall comment does not create an event on dashboard any more

app/helpers/notes_helper.rb
1 module NotesHelper 1 module NotesHelper
2 # Helps to distinguish e.g. commit notes in mr notes list 2 # Helps to distinguish e.g. commit notes in mr notes list
3 def note_for_main_target?(note) 3 def note_for_main_target?(note)
4 - note.for_wall? ||  
5 - (@target_type.camelize == note.noteable_type && !note.for_diff_line?) 4 + (@target_type.camelize == note.noteable_type && !note.for_diff_line?)
6 end 5 end
7 6
8 def note_target_fields 7 def note_target_fields
app/observers/activity_observer.rb
@@ -4,9 +4,12 @@ class ActivityObserver < ActiveRecord::Observer @@ -4,9 +4,12 @@ class ActivityObserver < ActiveRecord::Observer
4 def after_create(record) 4 def after_create(record)
5 event_author_id = record.author_id 5 event_author_id = record.author_id
6 6
7 - # Skip status notes  
8 - if record.kind_of?(Note) && record.note.include?("_Status changed to ")  
9 - return true 7 + if record.kind_of?(Note)
  8 + # Skip system status notes like 'status changed to close'
  9 + return true if record.note.include?("_Status changed to ")
  10 +
  11 + # Skip wall notes to prevent spaming of dashboard
  12 + return true if record.noteable_type.blank?
10 end 13 end
11 14
12 if event_author_id 15 if event_author_id