Commit 5443021a0e16887d14189f4203aea7f9282a1853
1 parent
9a0b763e
Exists in
master
and in
4 other branches
Update notifications mails and notify specs for GFM
Showing
10 changed files
with
34 additions
and
35 deletions
Show diff stats
app/mailers/notify.rb
@@ -17,22 +17,23 @@ class Notify < ActionMailer::Base | @@ -17,22 +17,23 @@ class Notify < ActionMailer::Base | ||
17 | def new_issue_email(issue_id) | 17 | def new_issue_email(issue_id) |
18 | @issue = Issue.find(issue_id) | 18 | @issue = Issue.find(issue_id) |
19 | @project = @issue.project | 19 | @project = @issue.project |
20 | - mail(:to => @issue.assignee_email, :subject => "gitlab | New Issue was created") | 20 | + mail(:to => @issue.assignee_email, :subject => "gitlab | new issue ##{@issue.id} | #{@issue.title} | #{@project.name}") |
21 | end | 21 | end |
22 | 22 | ||
23 | def note_wall_email(recipient_id, note_id) | 23 | def note_wall_email(recipient_id, note_id) |
24 | recipient = User.find(recipient_id) | 24 | recipient = User.find(recipient_id) |
25 | @note = Note.find(note_id) | 25 | @note = Note.find(note_id) |
26 | @project = @note.project | 26 | @project = @note.project |
27 | - mail(:to => recipient.email, :subject => "gitlab | #{@note.project_name} ") | 27 | + mail(:to => recipient.email, :subject => "gitlab | #{@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 | + @commit = CommitDecorator.decorate(@commit) | ||
34 | @project = @note.project | 35 | @project = @note.project |
35 | - mail(:to => recipient.email, :subject => "gitlab | note for commit | #{@note.project_name} ") | 36 | + mail(:to => recipient.email, :subject => "gitlab | note for commit #{@commit.short_id} | #{@commit.title} | #{@project.name}") |
36 | end | 37 | end |
37 | 38 | ||
38 | def note_merge_request_email(recipient_id, note_id) | 39 | def note_merge_request_email(recipient_id, note_id) |
@@ -40,7 +41,7 @@ class Notify < ActionMailer::Base | @@ -40,7 +41,7 @@ class Notify < ActionMailer::Base | ||
40 | @note = Note.find(note_id) | 41 | @note = Note.find(note_id) |
41 | @merge_request = @note.noteable | 42 | @merge_request = @note.noteable |
42 | @project = @note.project | 43 | @project = @note.project |
43 | - mail(:to => recipient.email, :subject => "gitlab | note for merge request | #{@note.project_name} ") | 44 | + mail(:to => recipient.email, :subject => "gitlab | note for merge request !#{@merge_request.id} | #{@project.name}") |
44 | end | 45 | end |
45 | 46 | ||
46 | def note_issue_email(recipient_id, note_id) | 47 | def note_issue_email(recipient_id, note_id) |
@@ -48,7 +49,7 @@ class Notify < ActionMailer::Base | @@ -48,7 +49,7 @@ class Notify < ActionMailer::Base | ||
48 | @note = Note.find(note_id) | 49 | @note = Note.find(note_id) |
49 | @issue = @note.noteable | 50 | @issue = @note.noteable |
50 | @project = @note.project | 51 | @project = @note.project |
51 | - mail(:to => recipient.email, :subject => "gitlab | note for issue #{@issue.id} | #{@note.project_name} ") | 52 | + mail(:to => recipient.email, :subject => "gitlab | note for issue ##{@issue.id} | #{@project.name}") |
52 | end | 53 | end |
53 | 54 | ||
54 | def note_wiki_email(recipient_id, note_id) | 55 | def note_wiki_email(recipient_id, note_id) |
@@ -56,13 +57,13 @@ class Notify < ActionMailer::Base | @@ -56,13 +57,13 @@ class Notify < ActionMailer::Base | ||
56 | @note = Note.find(note_id) | 57 | @note = Note.find(note_id) |
57 | @wiki = @note.noteable | 58 | @wiki = @note.noteable |
58 | @project = @note.project | 59 | @project = @note.project |
59 | - mail(:to => recipient.email, :subject => "gitlab | note for wiki | #{@note.project_name}") | 60 | + mail(:to => recipient.email, :subject => "gitlab | note for wiki | #{@project.name}") |
60 | end | 61 | end |
61 | 62 | ||
62 | def new_merge_request_email(merge_request_id) | 63 | def new_merge_request_email(merge_request_id) |
63 | @merge_request = MergeRequest.find(merge_request_id) | 64 | @merge_request = MergeRequest.find(merge_request_id) |
64 | @project = @merge_request.project | 65 | @project = @merge_request.project |
65 | - mail(:to => @merge_request.assignee_email, :subject => "gitlab | new merge request | #{@merge_request.title} ") | 66 | + mail(:to => @merge_request.assignee_email, :subject => "gitlab | new merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}") |
66 | end | 67 | end |
67 | 68 | ||
68 | def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) | 69 | def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) |
@@ -70,7 +71,7 @@ class Notify < ActionMailer::Base | @@ -70,7 +71,7 @@ class Notify < ActionMailer::Base | ||
70 | @merge_request = MergeRequest.find(merge_request_id) | 71 | @merge_request = MergeRequest.find(merge_request_id) |
71 | @previous_assignee ||= User.find(previous_assignee_id) | 72 | @previous_assignee ||= User.find(previous_assignee_id) |
72 | @project = @merge_request.project | 73 | @project = @merge_request.project |
73 | - mail(:to => recipient.email, :subject => "gitlab | merge request changed | #{@merge_request.title} ") | 74 | + mail(:to => recipient.email, :subject => "gitlab | changed merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}") |
74 | end | 75 | end |
75 | 76 | ||
76 | def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id) | 77 | def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id) |
@@ -78,6 +79,6 @@ class Notify < ActionMailer::Base | @@ -78,6 +79,6 @@ class Notify < ActionMailer::Base | ||
78 | @issue = Issue.find(issue_id) | 79 | @issue = Issue.find(issue_id) |
79 | @previous_assignee ||= User.find(previous_assignee_id) | 80 | @previous_assignee ||= User.find(previous_assignee_id) |
80 | @project = @issue.project | 81 | @project = @issue.project |
81 | - mail(:to => recipient.email, :subject => "gitlab | changed issue | #{@issue.title} ") | 82 | + mail(:to => recipient.email, :subject => "gitlab | changed issue ##{@issue.id} | #{@issue.title} | #{@project.name}") |
82 | end | 83 | end |
83 | end | 84 | end |
app/views/notify/new_issue_email.html.haml
@@ -10,7 +10,6 @@ | @@ -10,7 +10,6 @@ | ||
10 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 10 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
11 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 11 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
12 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 12 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
13 | - = link_to project_issue_url(@issue.project, @issue), :title => @issue.title do | ||
14 | - = "Issue ##{@issue.id.to_s}" | ||
15 | - = truncate(@issue.title, :length => 45) | 13 | + = "Issue ##{@issue.id}" |
14 | + = link_to_gfm truncate(@issue.title, :length => 45), project_issue_url(@issue.project, @issue), :title => @issue.title | ||
16 | %br | 15 | %br |
app/views/notify/new_merge_request_email.html.haml
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - New Merge Request | ||
8 | - = link_to truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request) | 7 | + = "New Merge Request !#{@merge_request.id}" |
8 | + = link_to_gfm truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request) | ||
9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
10 | %tr | 10 | %tr |
11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
app/views/notify/note_commit_email.html.haml
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - New comment for commit | ||
8 | - = link_to truncate(@commit.id.to_s, :length => 16), project_commit_url(@note.project, :id => @commit.id, :anchor => "note_#{@note.id}") | 7 | + = "New comment for Commit #{@commit.short_id}" |
8 | + = link_to_gfm truncate(@commit.title, :length => 16), project_commit_url(@note.project, :id => @commit.id, :anchor => "note_#{@note.id}") | ||
9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
10 | %tr | 10 | %tr |
11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
app/views/notify/note_issue_email.html.haml
@@ -4,10 +4,8 @@ | @@ -4,10 +4,8 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - New comment - | ||
8 | - = link_to project_issue_url(@issue.project, @issue, :anchor => "note_#{@note.id}") do | ||
9 | - = "Issue ##{@issue.id.to_s}" | ||
10 | - = truncate(@issue.title, :length => 35) | 7 | + = "New comment for Issue ##{@issue.id}" |
8 | + = link_to_gfm truncate(@issue.title, :length => 35), project_issue_url(@issue.project, @issue, :anchor => "note_#{@note.id}") | ||
11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
12 | %tr | 10 | %tr |
13 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
app/views/notify/note_merge_request_email.html.haml
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - New comment for Merge Request | ||
8 | - = link_to truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request, :anchor => "note_#{@note.id}") | 7 | + = "New comment for Merge Request !#{@merge_request.id}" |
8 | + = link_to_gfm truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request, :anchor => "note_#{@note.id}") | ||
9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
10 | %tr | 10 | %tr |
11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
app/views/notify/note_wiki_email.html.haml
@@ -4,9 +4,8 @@ | @@ -4,9 +4,8 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - New comment - | ||
8 | - = link_to project_issue_url(@wiki.project, @wiki, :anchor => "note_#{@note.id}") do | ||
9 | - = "Wiki ##{@wiki.title.to_s}" | 7 | + New comment for Wiki page |
8 | + = link_to_gfm @wiki.title, project_issue_url(@wiki.project, @wiki, :anchor => "note_#{@note.id}") | ||
10 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
11 | %tr | 10 | %tr |
12 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
app/views/notify/reassigned_issue_email.html.haml
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - Reassigned Issue | ||
8 | - = link_to truncate(@issue.title, :length => 16), project_issue_url(@issue.project, @issue) | 7 | + = "Reassigned Issue ##{@issue.id}" |
8 | + = link_to_gfm truncate(@issue.title, :length => 16), project_issue_url(@issue.project, @issue) | ||
9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
10 | %tr | 10 | %tr |
11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
app/views/notify/reassigned_merge_request_email.html.haml
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - Reassigned Merge Request | ||
8 | - = link_to truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request) | 7 | + = "Reassigned Merge Request !#{@merge_request.id}" |
8 | + = link_to_gfm truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request) | ||
9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
10 | %tr | 10 | %tr |
11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
spec/mailers/notify_spec.rb
@@ -60,7 +60,7 @@ describe Notify do | @@ -60,7 +60,7 @@ describe Notify do | ||
60 | it_behaves_like 'an assignee email' | 60 | it_behaves_like 'an assignee email' |
61 | 61 | ||
62 | it 'has the correct subject' do | 62 | it 'has the correct subject' do |
63 | - should have_subject /New Issue was created/ | 63 | + should have_subject /new issue ##{issue.id}/ |
64 | end | 64 | end |
65 | 65 | ||
66 | it 'contains a link to the new issue' do | 66 | it 'contains a link to the new issue' do |
@@ -102,7 +102,7 @@ describe Notify do | @@ -102,7 +102,7 @@ describe Notify do | ||
102 | it_behaves_like 'an assignee email' | 102 | it_behaves_like 'an assignee email' |
103 | 103 | ||
104 | it 'has the correct subject' do | 104 | it 'has the correct subject' do |
105 | - should have_subject /new merge request/ | 105 | + should have_subject /new merge request !#{merge_request.id}/ |
106 | end | 106 | end |
107 | 107 | ||
108 | it 'contains a link to the new merge request' do | 108 | it 'contains a link to the new merge request' do |
@@ -126,7 +126,7 @@ describe Notify do | @@ -126,7 +126,7 @@ describe Notify do | ||
126 | it_behaves_like 'a multiple recipients email' | 126 | it_behaves_like 'a multiple recipients email' |
127 | 127 | ||
128 | it 'has the correct subject' do | 128 | it 'has the correct subject' do |
129 | - should have_subject /merge request changed/ | 129 | + should have_subject /changed merge request !#{merge_request.id}/ |
130 | end | 130 | end |
131 | 131 | ||
132 | it 'contains the name of the previous assignee' do | 132 | it 'contains the name of the previous assignee' do |
@@ -188,6 +188,8 @@ describe Notify do | @@ -188,6 +188,8 @@ describe Notify do | ||
188 | mock(:commit).tap do |commit| | 188 | mock(:commit).tap do |commit| |
189 | commit.stub(:id).and_return('fauxsha1') | 189 | commit.stub(:id).and_return('fauxsha1') |
190 | commit.stub(:project).and_return(project) | 190 | commit.stub(:project).and_return(project) |
191 | + commit.stub(:short_id).and_return('fauxsha1') | ||
192 | + commit.stub(:safe_message).and_return('some message') | ||
191 | end | 193 | end |
192 | end | 194 | end |
193 | before(:each) { note.stub(:target).and_return(commit) } | 195 | before(:each) { note.stub(:target).and_return(commit) } |
@@ -197,7 +199,7 @@ describe Notify do | @@ -197,7 +199,7 @@ describe Notify do | ||
197 | it_behaves_like 'a note email' | 199 | it_behaves_like 'a note email' |
198 | 200 | ||
199 | it 'has the correct subject' do | 201 | it 'has the correct subject' do |
200 | - should have_subject /note for commit/ | 202 | + should have_subject /note for commit #{commit.short_id}/ |
201 | end | 203 | end |
202 | 204 | ||
203 | it 'contains a link to the commit' do | 205 | it 'contains a link to the commit' do |
@@ -215,7 +217,7 @@ describe Notify do | @@ -215,7 +217,7 @@ describe Notify do | ||
215 | it_behaves_like 'a note email' | 217 | it_behaves_like 'a note email' |
216 | 218 | ||
217 | it 'has the correct subject' do | 219 | it 'has the correct subject' do |
218 | - should have_subject /note for merge request/ | 220 | + should have_subject /note for merge request !#{merge_request.id}/ |
219 | end | 221 | end |
220 | 222 | ||
221 | it 'contains a link to the merge request note' do | 223 | it 'contains a link to the merge request note' do |
@@ -233,7 +235,7 @@ describe Notify do | @@ -233,7 +235,7 @@ describe Notify do | ||
233 | it_behaves_like 'a note email' | 235 | it_behaves_like 'a note email' |
234 | 236 | ||
235 | it 'has the correct subject' do | 237 | it 'has the correct subject' do |
236 | - should have_subject /note for issue #{issue.id}/ | 238 | + should have_subject /note for issue ##{issue.id}/ |
237 | end | 239 | end |
238 | 240 | ||
239 | it 'contains a link to the issue note' do | 241 | it 'contains a link to the issue note' do |