summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre de La Morinerie <pierre@capitainetrain.com>2014-02-18 14:44:00 +0100
committerPierre de La Morinerie <pierre@capitainetrain.com>2014-03-03 16:58:44 +0100
commit8e421d2bcb8088fa065b9bd8a6e1776c5140f4cd (patch)
treee3fbc1b99fb44d8a8f8764acfc69a3e920c4c70e
parentb59d105c0e541520073761b15ce575be3518cef2 (diff)
downloadgitlab-ce-8e421d2bcb8088fa065b9bd8a6e1776c5140f4cd.tar.gz
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.
-rw-r--r--app/views/notify/new_issue_email.html.haml12
-rw-r--r--app/views/notify/new_merge_request_email.html.haml8
-rw-r--r--spec/mailers/notify_spec.rb20
3 files changed, 31 insertions, 9 deletions
diff --git a/app/views/notify/new_issue_email.html.haml b/app/views/notify/new_issue_email.html.haml
index 05a91424713..f2f8eee18c4 100644
--- a/app/views/notify/new_issue_email.html.haml
+++ b/app/views/notify/new_issue_email.html.haml
@@ -1,6 +1,6 @@
-%p
- New Issue was created.
-%p
- Author: #{@issue.author_name}
-%p
- Assignee: #{@issue.assignee_name}
+-if @issue.description
+ = markdown(@issue.description)
+
+- if @issue.assignee_id.present?
+ %p
+ Assignee: #{@issue.assignee_name}
diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml
index bc52824c44f..2c012c4b215 100644
--- a/app/views/notify/new_merge_request_email.html.haml
+++ b/app/views/notify/new_merge_request_email.html.haml
@@ -2,6 +2,10 @@
= "New Merge Request ##{@merge_request.iid}"
%p
!= merge_path_description(@merge_request, '&rarr;')
-%p
- Assignee: #{@merge_request.author_name} &rarr; #{@merge_request.assignee_name}
+- if @merge_request.assignee_id.present?
+ %p
+ Assignee: #{@merge_request.author_name} &rarr; #{@merge_request.assignee_name}
+
+-if @merge_request.description
+ = markdown(@merge_request.description)
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 6b8d7a6f047..bc375622b32 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -146,7 +146,8 @@ describe Notify do
end
context 'for issues' do
- let(:issue) { create(:issue, author: current_user, assignee: assignee, project: project ) }
+ let(:issue) { create(:issue, author: current_user, assignee: assignee, project: project) }
+ let(:issue_with_description) { create(:issue, author: current_user, assignee: assignee, project: project, description: Faker::Lorem.sentence) }
describe 'that are new' do
subject { Notify.new_issue_email(issue.assignee_id, issue.id) }
@@ -162,6 +163,14 @@ describe Notify do
end
end
+ describe 'that are new with a description' do
+ subject { Notify.new_issue_email(issue_with_description.assignee_id, issue_with_description.id) }
+
+ it 'contains the description' do
+ should have_body_text /#{issue_with_description.description}/
+ end
+ end
+
describe 'that have been reassigned' do
subject { Notify.reassigned_issue_email(recipient.id, issue.id, previous_assignee.id, current_user) }
@@ -221,6 +230,7 @@ describe Notify do
context 'for merge requests' do
let(:merge_request) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project) }
+ let(:merge_request_with_description) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project, description: Faker::Lorem.sentence) }
describe 'that are new' do
subject { Notify.new_merge_request_email(merge_request.assignee_id, merge_request.id) }
@@ -244,6 +254,14 @@ describe Notify do
end
end
+ describe 'that are new with a description' do
+ subject { Notify.new_merge_request_email(merge_request_with_description.assignee_id, merge_request_with_description.id) }
+
+ it 'contains the description' do
+ should have_body_text /#{merge_request_with_description.description}/
+ end
+ end
+
describe 'that are reassigned' do
subject { Notify.reassigned_merge_request_email(recipient.id, merge_request.id, previous_assignee.id, current_user.id) }