Merge branch '53933-include-dates-in-milestone-change-email' into 'master'
Add date range to milestone changed emails Closes #53933 See merge request gitlab-org/gitlab-ce!23762
This commit is contained in:
commit
1567f17941
10 changed files with 50 additions and 7 deletions
|
@ -56,7 +56,9 @@ module Emails
|
|||
|
||||
@milestone = milestone
|
||||
@milestone_url = milestone_url(@milestone)
|
||||
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id, reason))
|
||||
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id, reason).merge({
|
||||
template_name: 'changed_milestone_email'
|
||||
}))
|
||||
end
|
||||
|
||||
def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id, reason = nil)
|
||||
|
|
|
@ -51,7 +51,9 @@ module Emails
|
|||
|
||||
@milestone = milestone
|
||||
@milestone_url = milestone_url(@milestone)
|
||||
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
|
||||
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason).merge({
|
||||
template_name: 'changed_milestone_email'
|
||||
}))
|
||||
end
|
||||
|
||||
def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)
|
||||
|
|
|
@ -16,6 +16,7 @@ class Notify < BaseMailer
|
|||
include Emails::AutoDevops
|
||||
include Emails::RemoteMirrors
|
||||
|
||||
helper MilestonesHelper
|
||||
helper MergeRequestsHelper
|
||||
helper DiffHelper
|
||||
helper BlobHelper
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
%p
|
||||
Milestone changed to
|
||||
%strong= link_to(@milestone.name, @milestone_url)
|
||||
- if date_range = milestone_date_range(@milestone)
|
||||
= "(#{date_range})"
|
1
app/views/notify/changed_milestone_email.text.erb
Normal file
1
app/views/notify/changed_milestone_email.text.erb
Normal file
|
@ -0,0 +1 @@
|
|||
Milestone changed to <%= @milestone.name %><% if date_range = milestone_date_range(@milestone) %> (<%= date_range %>)<% end %> ( <%= @milestone_url %> )
|
|
@ -1 +0,0 @@
|
|||
Milestone changed to <%= @milestone.name %> ( <%= @milestone_url %> )
|
|
@ -1,3 +0,0 @@
|
|||
%p
|
||||
Milestone changed to
|
||||
%strong= link_to(@milestone.name, @milestone_url)
|
|
@ -1 +0,0 @@
|
|||
Milestone changed to <%= @milestone.name %> ( <%= @milestone_url %> )
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Add date range in milestone change email notifications
|
||||
merge_request: 23762
|
||||
author:
|
||||
type: changed
|
35
spec/views/notify/changed_milestone_email.html.haml_spec.rb
Normal file
35
spec/views/notify/changed_milestone_email.html.haml_spec.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'notify/changed_milestone_email.html.haml' do
|
||||
let(:milestone) { create(:milestone, title: 'some-milestone') }
|
||||
let(:milestone_link) { milestone_url(milestone) }
|
||||
|
||||
before do
|
||||
assign(:milestone, milestone)
|
||||
assign(:milestone_url, milestone_link)
|
||||
end
|
||||
|
||||
context 'milestone without start and due dates' do
|
||||
it 'renders without date range' do
|
||||
render
|
||||
|
||||
expect(rendered).to have_content('Milestone changed to some-milestone', exact: true)
|
||||
expect(rendered).to have_link('some-milestone', href: milestone_link)
|
||||
end
|
||||
end
|
||||
|
||||
context 'milestone with start and due dates' do
|
||||
before do
|
||||
milestone.update(start_date: '2018-01-01', due_date: '2018-12-31')
|
||||
end
|
||||
|
||||
it 'renders with date range' do
|
||||
render
|
||||
|
||||
expect(rendered).to have_content('Milestone changed to some-milestone (Jan 1, 2018–Dec 31, 2018)', exact: true)
|
||||
expect(rendered).to have_link('some-milestone', href: milestone_link)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue