diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 328825df..1fa1a2b8 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -28,12 +28,11 @@ class Notify < ActionMailer::Base mail(:to => @user['email'], :subject => "gitlab | #{@note.project.name} ") end - def note_commit_email(user, note) - @user = user - @note = Note.find(note['id']) - @project = @note.project + def note_commit_email(recipient_id, note_id) + recipient = User.find(recipient_id) + @note = Note.find(note_id) @commit = @note.target - mail(:to => @user['email'], :subject => "gitlab | note for commit | #{@note.project.name} ") + mail(:to => recipient.email, :subject => "gitlab | note for commit | #{@note.project.name} ") end def note_merge_request_email(recipient_id, note_id) diff --git a/app/views/notify/note_commit_email.html.haml b/app/views/notify/note_commit_email.html.haml index aee8fe6c..c834f1dd 100644 --- a/app/views/notify/note_commit_email.html.haml +++ b/app/views/notify/note_commit_email.html.haml @@ -5,13 +5,13 @@ %td{:align => "left", :style => "padding: 20px 0 0;"} %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} New comment for commit - = link_to truncate(@commit.id.to_s, :length => 16), project_commit_url(@project, :id => @commit.id, :anchor => "note_#{@note.id}") + = link_to truncate(@commit.id.to_s, :length => 16), project_commit_url(@commit.project, :id => @commit.id, :anchor => "note_#{@note.id}") %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %tr %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %td{:style => "padding: 15px 0 15px;", :valign => "top"} %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} - %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author.name} + %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} left next message: %br %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"} diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index e9c87b9b..7bf42671 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -190,7 +190,8 @@ describe Notify do describe 'on a commit' do let(:commit) do mock(:commit).tap do |commit| - commit.stub(:id).and_return('faux_sha_1') + commit.stub(:id).and_return('fauxsha1') + commit.stub(:project).and_return(project) end end before(:each) { note.stub(:target).and_return(commit) } @@ -204,7 +205,7 @@ describe Notify do end it 'contains a link to the commit' do - should have_body_text /faux_sha_1/ + should have_body_text /fauxsha1/ end end