Commit ffe064a2c1cb831258bc1019215f2defe23e7f99

Authored by Dmitriy Zaporozhets
1 parent cf3f22cc

Bit of cleanup and improving mailer

app/mailers/notify.rb
... ... @@ -148,12 +148,15 @@ class Notify < ActionMailer::Base
148 148 # >> @project = Project.last
149 149 # => #<Project id: 1, name: "Ruby on Rails", path: "ruby_on_rails", ...>
150 150 # >> subject('Lorem ipsum')
151   - # => "GitLab | Lorem ipsum | Ruby on Rails"
  151 + # => "GitLab | Ruby on Rails | Lorem ipsum "
152 152 #
153 153 # # Accepts multiple arguments
154 154 # >> subject('Lorem ipsum', 'Dolor sit amet')
155 155 # => "GitLab | Lorem ipsum | Dolor sit amet"
156 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 161 end
159 162 end
... ...
app/views/layouts/notify.html.haml
... ... @@ -13,10 +13,10 @@
13 13 %td{style: "font-size: 0px;", width: "20"}
14 14
15 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 17 GITLAB
18 18 - if @project
19   - &rarr; #{@project.name_with_namespace}
  19 + \/ #{@project.name_with_namespace}
20 20 %table{align: "center", bgcolor: "#fff", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; background: #fff;", width: "600"}
21 21 %tr= yield
22 22 %tr
... ...
app/views/notify/issue_status_changed_email.html.haml
1 1 %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"}
2 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 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 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 7 = "Issue was #{@issue_status} by #{@updated_by.name}"
8 8 %td{style: "font-size: 1px; line-height: 1px;", width: "21"}
... ...
app/views/notify/new_issue_email.html.haml
1 1 %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"}
2 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 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 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 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 9 %tr
10   - %td{style: "font-size: 1px; line-height: 1px;", width: "21"}
  10 + %td{width: "21"}
11 11 %td{align: "left", style: "padding: 20px 0 0;"}
12 12 %p{style: "color:#646464 !important; line-height: 26px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; "}
13 13 = "Issue ##{@issue.id}"
... ...
app/views/notify/note_merge_request_email.html.haml
... ... @@ -2,7 +2,7 @@
2 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 3 %tr
4 4 %td{width: "21"}
5   - %td{align: "left", style: "padding: 20px 0 0;"}
  5 + %td
6 6 %h2{style: "color:#646464; font-weight: normal;"}
7 7 - if @note.for_diff_line?
8 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 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 3 %tr
4 4 %td{style: "font-size: 1px; line-height: 1px;", width: "21"}
5   - %td{align: "left", style: "padding: 20px 0 0;"}
  5 + %td
6 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 7 = "Reassigned Issue ##{@issue.id}"
8 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 60 it_behaves_like 'an assignee email'
61 61  
62 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 64 end
65 65  
66 66 it 'contains a link to the new issue' do
... ...