# File app/observers/note_observer.rb, line 3 def after_create(note) send_notify_mails(note) end
Notifies the whole team except the author of note
# File app/observers/note_observer.rb, line 22 def notify_team(note) # Note: wall posts are not "attached" to anything, so fall back to "Wall" noteable_type = note.noteable_type || "Wall" notify_method = "note_#{noteable_type.underscore}_email".to_sym if Notify.respond_to? notify_method team_without_note_author(note).map do |u| Notify.send(notify_method, u.id, note.id).deliver end end end
# File app/observers/note_observer.rb, line 9 def send_notify_mails(note) if note.notify notify_team(note) elsif note.notify_author # Notify only author of resource Notify.note_commit_email(note.commit_author.id, note.id).deliver else # Otherwise ignore it nil end end