Commit ffe064a2c1cb831258bc1019215f2defe23e7f99
1 parent
cf3f22cc
Exists in
master
and in
4 other branches
Bit of cleanup and improving mailer
Showing
7 changed files
with
16 additions
and
13 deletions
Show diff stats
app/mailers/notify.rb
@@ -148,12 +148,15 @@ class Notify < ActionMailer::Base | @@ -148,12 +148,15 @@ class Notify < ActionMailer::Base | ||
148 | # >> @project = Project.last | 148 | # >> @project = Project.last |
149 | # => #<Project id: 1, name: "Ruby on Rails", path: "ruby_on_rails", ...> | 149 | # => #<Project id: 1, name: "Ruby on Rails", path: "ruby_on_rails", ...> |
150 | # >> subject('Lorem ipsum') | 150 | # >> subject('Lorem ipsum') |
151 | - # => "GitLab | Lorem ipsum | Ruby on Rails" | 151 | + # => "GitLab | Ruby on Rails | Lorem ipsum " |
152 | # | 152 | # |
153 | # # Accepts multiple arguments | 153 | # # Accepts multiple arguments |
154 | # >> subject('Lorem ipsum', 'Dolor sit amet') | 154 | # >> subject('Lorem ipsum', 'Dolor sit amet') |
155 | # => "GitLab | Lorem ipsum | Dolor sit amet" | 155 | # => "GitLab | Lorem ipsum | Dolor sit amet" |
156 | def subject(*extra) | 156 | def subject(*extra) |
157 | - "GitLab | " << extra.join(' | ') << (@project ? " | #{@project.name_with_namespace}" : "") | 157 | + subject = "GitLab" |
158 | + subject << (@project ? " | #{@project.name_with_namespace}" : "") | ||
159 | + subject << " | " + extra.join(' | ') if extra.present? | ||
160 | + subject | ||
158 | end | 161 | end |
159 | end | 162 | end |
app/views/layouts/notify.html.haml
@@ -13,10 +13,10 @@ | @@ -13,10 +13,10 @@ | ||
13 | %td{style: "font-size: 0px;", width: "20"} | 13 | %td{style: "font-size: 0px;", width: "20"} |
14 | \ | 14 | \ |
15 | %td{align: "left", style: "padding: 10px 0", width: "580"} | 15 | %td{align: "left", style: "padding: 10px 0", width: "580"} |
16 | - %h1{style: "font-size: 24px; color: #BBBBBB; font: normal 22px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 32px;"} | 16 | + %h1{style: "color: #BBBBBB; font: normal 20px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 32px;"} |
17 | GITLAB | 17 | GITLAB |
18 | - if @project | 18 | - if @project |
19 | - → #{@project.name_with_namespace} | 19 | + \/ #{@project.name_with_namespace} |
20 | %table{align: "center", bgcolor: "#fff", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; background: #fff;", width: "600"} | 20 | %table{align: "center", bgcolor: "#fff", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; background: #fff;", width: "600"} |
21 | %tr= yield | 21 | %tr= yield |
22 | %tr | 22 | %tr |
app/views/notify/issue_status_changed_email.html.haml
1 | %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} | 1 | %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} |
2 | %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} | 2 | %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} |
3 | %tr | 3 | %tr |
4 | - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} | ||
5 | - %td{align: "left", style: "padding: 20px 0 0;"} | 4 | + %td{width: "21"} |
5 | + %td | ||
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 | = "Issue was #{@issue_status} by #{@updated_by.name}" | 7 | = "Issue was #{@issue_status} by #{@updated_by.name}" |
8 | %td{style: "font-size: 1px; line-height: 1px;", width: "21"} | 8 | %td{style: "font-size: 1px; line-height: 1px;", width: "21"} |
app/views/notify/new_issue_email.html.haml
1 | %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} | 1 | %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} |
2 | %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} | 2 | %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} |
3 | %tr | 3 | %tr |
4 | - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} | ||
5 | - %td{align: "left", style: "padding: 20px 0 0;"} | 4 | + %td{width: "21"} |
5 | + %td | ||
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 Issue was created and assigned to you. | 7 | New Issue was created and assigned to you. |
8 | - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} | 8 | + %td{width: "21"} |
9 | %tr | 9 | %tr |
10 | - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} | 10 | + %td{width: "21"} |
11 | %td{align: "left", style: "padding: 20px 0 0;"} | 11 | %td{align: "left", style: "padding: 20px 0 0;"} |
12 | %p{style: "color:#646464 !important; line-height: 26px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; "} | 12 | %p{style: "color:#646464 !important; line-height: 26px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; "} |
13 | = "Issue ##{@issue.id}" | 13 | = "Issue ##{@issue.id}" |
app/views/notify/note_merge_request_email.html.haml
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} | 2 | %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} |
3 | %tr | 3 | %tr |
4 | %td{width: "21"} | 4 | %td{width: "21"} |
5 | - %td{align: "left", style: "padding: 20px 0 0;"} | 5 | + %td |
6 | %h2{style: "color:#646464; font-weight: normal;"} | 6 | %h2{style: "color:#646464; font-weight: normal;"} |
7 | - if @note.for_diff_line? | 7 | - if @note.for_diff_line? |
8 | = link_to "New comment on diff", diffs_project_merge_request_url(@merge_request.project, @merge_request, anchor: "note_#{@note.id}") | 8 | = link_to "New comment on diff", diffs_project_merge_request_url(@merge_request.project, @merge_request, anchor: "note_#{@note.id}") |
app/views/notify/reassigned_issue_email.html.haml
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} | 2 | %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} |
3 | %tr | 3 | %tr |
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 |
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 ##{@issue.id}" | 7 | = "Reassigned Issue ##{@issue.id}" |
8 | = link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue) | 8 | = link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue) |
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 ##{issue.id} \| #{issue.title} \| #{project.name}/ | 63 | + should have_subject /#{project.name} \| new issue ##{issue.id} \| #{issue.title}/ |
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 |