Commit fced9678eae29864a1062a3d977cc611790a1a69

Authored by Riyad Preukschas
2 parents db3d90cb 9588a232

Merge pull request #1694 from robbkidd/fix_notification_of_wall_notes

Fix notification for notes on a wall. (regression)
app/observers/note_observer.rb
@@ -16,7 +16,8 @@ class NoteObserver < ActiveRecord::Observer @@ -16,7 +16,8 @@ class NoteObserver < ActiveRecord::Observer
16 protected 16 protected
17 17
18 def notify_team_of_new_note(note) 18 def notify_team_of_new_note(note)
19 - notify_method = 'note_' + note.noteable_type.underscore + '_email' 19 + note_is_on = note.noteable_type || 'Wall'
  20 + notify_method = 'note_' + note_is_on.underscore + '_email'
20 21
21 if Notify.respond_to? notify_method 22 if Notify.respond_to? notify_method
22 team_without_note_author(note).map do |u| 23 team_without_note_author(note).map do |u|
spec/observers/note_observer_spec.rb
@@ -80,7 +80,7 @@ describe NoteObserver do @@ -80,7 +80,7 @@ describe NoteObserver do
80 subject.send(:notify_team_of_new_note, note) 80 subject.send(:notify_team_of_new_note, note)
81 end 81 end
82 it 'a wall' do 82 it 'a wall' do
83 - note.stub(:noteable_type).and_return('Wall') 83 + note.stub(:noteable_type).and_return(nil)
84 Notify.should_receive(:note_wall_email).twice.and_return(double(deliver: true)) 84 Notify.should_receive(:note_wall_email).twice.and_return(double(deliver: true))
85 85
86 subject.send(:notify_team_of_new_note, note) 86 subject.send(:notify_team_of_new_note, note)