Commit 9588a232428d7045fb3e86ce36a81437a854b160
1 parent
db3d90cb
Exists in
master
and in
4 other branches
Fix notification for notes on a wall.
The fact that Notes on Walls have a noteable_type value of "nil" got lost in the refactoring of the observer.
Showing
2 changed files
with
3 additions
and
2 deletions
Show diff stats
app/observers/note_observer.rb
... | ... | @@ -16,7 +16,8 @@ class NoteObserver < ActiveRecord::Observer |
16 | 16 | protected |
17 | 17 | |
18 | 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 | 22 | if Notify.respond_to? notify_method |
22 | 23 | team_without_note_author(note).map do |u| | ... | ... |
spec/observers/note_observer_spec.rb
... | ... | @@ -80,7 +80,7 @@ describe NoteObserver do |
80 | 80 | subject.send(:notify_team_of_new_note, note) |
81 | 81 | end |
82 | 82 | it 'a wall' do |
83 | - note.stub(:noteable_type).and_return('Wall') | |
83 | + note.stub(:noteable_type).and_return(nil) | |
84 | 84 | Notify.should_receive(:note_wall_email).twice.and_return(double(deliver: true)) |
85 | 85 | |
86 | 86 | subject.send(:notify_team_of_new_note, note) | ... | ... |