From 383ac10ca5797818f7a61d04fbff0fbf54e87c0e Mon Sep 17 00:00:00 2001
From: Alex Elman <aelman@indeed.com>
Date: Wed, 27 Aug 2014 11:20:28 -0500
Subject: [PATCH] Issue-280 Send notifications when a note is added to a commit
 and author is a group member

This fixes a bug where commit authors weren't receiving email notifications for notes added to their commits and their membership was in the group but not the project. The fix is to look up membership via the team object which accounts for both project and group members.
---
 app/models/note.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/models/note.rb b/app/models/note.rb
index f0ed7580b4c..996def0478a 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -251,8 +251,8 @@ class Note < ActiveRecord::Base
 
   def commit_author
     @commit_author ||=
-      project.users.find_by(email: noteable.author_email) ||
-      project.users.find_by(name: noteable.author_name)
+      project.team.users.find_by(email: noteable.author_email) ||
+      project.team.users.find_by(name: noteable.author_name)
   rescue
     nil
   end
-- 
2.30.9