From 2d124d9496ea2bca71a25a29a4301cc718b5001c Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Tue, 15 May 2012 19:25:21 -0400 Subject: [PATCH] Add delegate for project's name on Note. --- app/mailers/notify.rb | 8 ++++---- app/models/note.rb | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index bb46ba04..a4ffd97f 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -24,28 +24,28 @@ class Notify < ActionMailer::Base def note_wall_email(recipient_id, note_id) recipient = User.find(recipient_id) @note = Note.find(note_id) - mail(:to => recipient.email, :subject => "gitlab | #{@note.project.name} ") + mail(:to => recipient.email, :subject => "gitlab | #{@note.project_name} ") end def note_commit_email(recipient_id, note_id) recipient = User.find(recipient_id) @note = Note.find(note_id) @commit = @note.target - mail(:to => recipient.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) recipient = User.find(recipient_id) @note = Note.find(note_id) @merge_request = @note.noteable - mail(:to => recipient.email, :subject => "gitlab | note for merge request | #{@note.project.name} ") + mail(:to => recipient.email, :subject => "gitlab | note for merge request | #{@note.project_name} ") end def note_issue_email(recipient_id, note_id) recipient = User.find(recipient_id) @note = Note.find(note_id) @issue = @note.noteable - mail(:to => recipient.email, :subject => "gitlab | note for issue #{@issue.id} | #{@note.project.name} ") + mail(:to => recipient.email, :subject => "gitlab | note for issue #{@issue.id} | #{@note.project_name} ") end def new_merge_request_email(merge_request) diff --git a/app/models/note.rb b/app/models/note.rb index cee726ea..c655eb80 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -7,6 +7,10 @@ class Note < ActiveRecord::Base belongs_to :author, :class_name => "User" + delegate :name, + :to => :project, + :prefix => true + delegate :name, :email, :to => :author,