Commit 2d124d9496ea2bca71a25a29a4301cc718b5001c

Authored by Robb Kidd
1 parent 41c00a20

Add delegate for project's name on Note.

Showing 2 changed files with 8 additions and 4 deletions   Show diff stats
app/mailers/notify.rb
... ... @@ -24,28 +24,28 @@ class Notify < ActionMailer::Base
24 24 def note_wall_email(recipient_id, note_id)
25 25 recipient = User.find(recipient_id)
26 26 @note = Note.find(note_id)
27   - mail(:to => recipient.email, :subject => "gitlab | #{@note.project.name} ")
  27 + mail(:to => recipient.email, :subject => "gitlab | #{@note.project_name} ")
28 28 end
29 29  
30 30 def note_commit_email(recipient_id, note_id)
31 31 recipient = User.find(recipient_id)
32 32 @note = Note.find(note_id)
33 33 @commit = @note.target
34   - mail(:to => recipient.email, :subject => "gitlab | note for commit | #{@note.project.name} ")
  34 + mail(:to => recipient.email, :subject => "gitlab | note for commit | #{@note.project_name} ")
35 35 end
36 36  
37 37 def note_merge_request_email(recipient_id, note_id)
38 38 recipient = User.find(recipient_id)
39 39 @note = Note.find(note_id)
40 40 @merge_request = @note.noteable
41   - mail(:to => recipient.email, :subject => "gitlab | note for merge request | #{@note.project.name} ")
  41 + mail(:to => recipient.email, :subject => "gitlab | note for merge request | #{@note.project_name} ")
42 42 end
43 43  
44 44 def note_issue_email(recipient_id, note_id)
45 45 recipient = User.find(recipient_id)
46 46 @note = Note.find(note_id)
47 47 @issue = @note.noteable
48   - mail(:to => recipient.email, :subject => "gitlab | note for issue #{@issue.id} | #{@note.project.name} ")
  48 + mail(:to => recipient.email, :subject => "gitlab | note for issue #{@issue.id} | #{@note.project_name} ")
49 49 end
50 50  
51 51 def new_merge_request_email(merge_request)
... ...
app/models/note.rb
... ... @@ -8,6 +8,10 @@ class Note < ActiveRecord::Base
8 8 :class_name => "User"
9 9  
10 10 delegate :name,
  11 + :to => :project,
  12 + :prefix => true
  13 +
  14 + delegate :name,
11 15 :email,
12 16 :to => :author,
13 17 :prefix => true
... ...