Merge pull request #1694 from robbkidd/fix_notification_of_wall_notes

Fix notification for notes on a wall. (regression)
This commit is contained in:
Riyad Preukschas 2012-10-13 12:21:56 -07:00
commit fced9678ea
2 changed files with 3 additions and 2 deletions

View file

@ -16,7 +16,8 @@ class NoteObserver < ActiveRecord::Observer
protected protected
def notify_team_of_new_note(note) def notify_team_of_new_note(note)
notify_method = 'note_' + note.noteable_type.underscore + '_email' note_is_on = note.noteable_type || 'Wall'
notify_method = 'note_' + note_is_on.underscore + '_email'
if Notify.respond_to? notify_method if Notify.respond_to? notify_method
team_without_note_author(note).map do |u| team_without_note_author(note).map do |u|

View file

@ -80,7 +80,7 @@ describe NoteObserver do
subject.send(:notify_team_of_new_note, note) subject.send(:notify_team_of_new_note, note)
end end
it 'a wall' do it 'a wall' do
note.stub(:noteable_type).and_return('Wall') note.stub(:noteable_type).and_return(nil)
Notify.should_receive(:note_wall_email).twice.and_return(double(deliver: true)) Notify.should_receive(:note_wall_email).twice.and_return(double(deliver: true))
subject.send(:notify_team_of_new_note, note) subject.send(:notify_team_of_new_note, note)