From c78ebc3ebb9c22c0c40749b44b5538ea35e237b6 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Fri, 1 Feb 2013 08:59:30 +0200
Subject: [PATCH] Fix sending commit note email to id instead email

---
 app/mailers/notify.rb          | 4 ++--
 app/observers/note_observer.rb | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 0ed06475fa8..c672940a05e 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -63,12 +63,12 @@ class Notify < ActionMailer::Base
   # Note
   #
 
-  def note_commit_email(commit_autor_email, note_id)
+  def note_commit_email(recipient_id, note_id)
     @note = Note.find(note_id)
     @commit = @note.noteable
     @commit = CommitDecorator.decorate(@commit)
     @project = @note.project
-    mail(to: commit_autor_email, subject: subject("note for commit #{@commit.short_id}", @commit.title))
+    mail(to: recipient(recipient_id), subject: subject("note for commit #{@commit.short_id}", @commit.title))
   end
 
   def note_issue_email(recipient_id, note_id)
diff --git a/app/observers/note_observer.rb b/app/observers/note_observer.rb
index 2ec644ef7c1..3f6d1dfcb70 100644
--- a/app/observers/note_observer.rb
+++ b/app/observers/note_observer.rb
@@ -11,7 +11,7 @@ class NoteObserver < ActiveRecord::Observer
       notify_team(note)
     elsif note.notify_author
       # Notify only author of resource
-      Notify.delay.note_commit_email(note.noteable.author_email, note.id)
+      Notify.delay.note_commit_email(note.commit_author.id, note.id)
     else
       # Otherwise ignore it
       nil
-- 
GitLab