Commit 2d124d9496ea2bca71a25a29a4301cc718b5001c
1 parent
41c00a20
Exists in
master
and in
4 other branches
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,28 +24,28 @@ class Notify < ActionMailer::Base | ||
| 24 | def note_wall_email(recipient_id, note_id) | 24 | def note_wall_email(recipient_id, note_id) |
| 25 | recipient = User.find(recipient_id) | 25 | recipient = User.find(recipient_id) |
| 26 | @note = Note.find(note_id) | 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 | end | 28 | end |
| 29 | 29 | ||
| 30 | def note_commit_email(recipient_id, note_id) | 30 | def note_commit_email(recipient_id, note_id) |
| 31 | recipient = User.find(recipient_id) | 31 | recipient = User.find(recipient_id) |
| 32 | @note = Note.find(note_id) | 32 | @note = Note.find(note_id) |
| 33 | @commit = @note.target | 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 | end | 35 | end |
| 36 | 36 | ||
| 37 | def note_merge_request_email(recipient_id, note_id) | 37 | def note_merge_request_email(recipient_id, note_id) |
| 38 | recipient = User.find(recipient_id) | 38 | recipient = User.find(recipient_id) |
| 39 | @note = Note.find(note_id) | 39 | @note = Note.find(note_id) |
| 40 | @merge_request = @note.noteable | 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 | end | 42 | end |
| 43 | 43 | ||
| 44 | def note_issue_email(recipient_id, note_id) | 44 | def note_issue_email(recipient_id, note_id) |
| 45 | recipient = User.find(recipient_id) | 45 | recipient = User.find(recipient_id) |
| 46 | @note = Note.find(note_id) | 46 | @note = Note.find(note_id) |
| 47 | @issue = @note.noteable | 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 | end | 49 | end |
| 50 | 50 | ||
| 51 | def new_merge_request_email(merge_request) | 51 | def new_merge_request_email(merge_request) |
app/models/note.rb
| @@ -8,6 +8,10 @@ class Note < ActiveRecord::Base | @@ -8,6 +8,10 @@ class Note < ActiveRecord::Base | ||
| 8 | :class_name => "User" | 8 | :class_name => "User" |
| 9 | 9 | ||
| 10 | delegate :name, | 10 | delegate :name, |
| 11 | + :to => :project, | ||
| 12 | + :prefix => true | ||
| 13 | + | ||
| 14 | + delegate :name, | ||
| 11 | :email, | 15 | :email, |
| 12 | :to => :author, | 16 | :to => :author, |
| 13 | :prefix => true | 17 | :prefix => true |