Commit 8e421d2bcb8088fa065b9bd8a6e1776c5140f4cd

Authored by Pierre de La Morinerie
1 parent b59d105c

Add the description to the "new issue" and "new merge request" emails

Previously the content of the issue or merge request was missing from
the email.
app/views/notify/new_issue_email.html.haml
1   -%p
2   - New Issue was created.
3   -%p
4   - Author: #{@issue.author_name}
5   -%p
6   - Assignee: #{@issue.assignee_name}
  1 +-if @issue.description
  2 + = markdown(@issue.description)
  3 +
  4 +- if @issue.assignee_id.present?
  5 + %p
  6 + Assignee: #{@issue.assignee_name}
... ...
app/views/notify/new_merge_request_email.html.haml
... ... @@ -2,6 +2,10 @@
2 2 = "New Merge Request ##{@merge_request.iid}"
3 3 %p
4 4 != merge_path_description(@merge_request, '→')
5   -%p
6   - Assignee: #{@merge_request.author_name} → #{@merge_request.assignee_name}
7 5  
  6 +- if @merge_request.assignee_id.present?
  7 + %p
  8 + Assignee: #{@merge_request.author_name} → #{@merge_request.assignee_name}
  9 +
  10 +-if @merge_request.description
  11 + = markdown(@merge_request.description)
... ...
spec/mailers/notify_spec.rb
... ... @@ -146,7 +146,8 @@ describe Notify do
146 146 end
147 147  
148 148 context 'for issues' do
149   - let(:issue) { create(:issue, author: current_user, assignee: assignee, project: project ) }
  149 + let(:issue) { create(:issue, author: current_user, assignee: assignee, project: project) }
  150 + let(:issue_with_description) { create(:issue, author: current_user, assignee: assignee, project: project, description: Faker::Lorem.sentence) }
150 151  
151 152 describe 'that are new' do
152 153 subject { Notify.new_issue_email(issue.assignee_id, issue.id) }
... ... @@ -162,6 +163,14 @@ describe Notify do
162 163 end
163 164 end
164 165  
  166 + describe 'that are new with a description' do
  167 + subject { Notify.new_issue_email(issue_with_description.assignee_id, issue_with_description.id) }
  168 +
  169 + it 'contains the description' do
  170 + should have_body_text /#{issue_with_description.description}/
  171 + end
  172 + end
  173 +
165 174 describe 'that have been reassigned' do
166 175 subject { Notify.reassigned_issue_email(recipient.id, issue.id, previous_assignee.id, current_user) }
167 176  
... ... @@ -221,6 +230,7 @@ describe Notify do
221 230  
222 231 context 'for merge requests' do
223 232 let(:merge_request) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project) }
  233 + let(:merge_request_with_description) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project, description: Faker::Lorem.sentence) }
224 234  
225 235 describe 'that are new' do
226 236 subject { Notify.new_merge_request_email(merge_request.assignee_id, merge_request.id) }
... ... @@ -244,6 +254,14 @@ describe Notify do
244 254 end
245 255 end
246 256  
  257 + describe 'that are new with a description' do
  258 + subject { Notify.new_merge_request_email(merge_request_with_description.assignee_id, merge_request_with_description.id) }
  259 +
  260 + it 'contains the description' do
  261 + should have_body_text /#{merge_request_with_description.description}/
  262 + end
  263 + end
  264 +
247 265 describe 'that are reassigned' do
248 266 subject { Notify.reassigned_merge_request_email(recipient.id, merge_request.id, previous_assignee.id, current_user.id) }
249 267  
... ...