Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
51ac77af
Commit
51ac77af
authored
Dec 12, 2018
by
Heinrich Lee Yu
Committed by
Heinrich Lee Yu
Dec 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add date range to milestone changed emails
Also refactored issues and MRs to use the same email template file
parent
62d250ff
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
45 additions
and
7 deletions
+45
-7
app/mailers/emails/issues.rb
app/mailers/emails/issues.rb
+3
-1
app/mailers/emails/merge_requests.rb
app/mailers/emails/merge_requests.rb
+3
-1
app/mailers/notify.rb
app/mailers/notify.rb
+1
-0
app/views/notify/changed_milestone_email.html.haml
app/views/notify/changed_milestone_email.html.haml
+2
-0
app/views/notify/changed_milestone_email.text.erb
app/views/notify/changed_milestone_email.text.erb
+1
-0
app/views/notify/changed_milestone_issue_email.text.erb
app/views/notify/changed_milestone_issue_email.text.erb
+0
-1
app/views/notify/changed_milestone_merge_request_email.html.haml
...ws/notify/changed_milestone_merge_request_email.html.haml
+0
-3
app/views/notify/changed_milestone_merge_request_email.text.erb
...ews/notify/changed_milestone_merge_request_email.text.erb
+0
-1
spec/views/notify/changed_milestone_email.html.haml_spec.rb
spec/views/notify/changed_milestone_email.html.haml_spec.rb
+35
-0
No files found.
app/mailers/emails/issues.rb
View file @
51ac77af
...
...
@@ -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
)
...
...
app/mailers/emails/merge_requests.rb
View file @
51ac77af
...
...
@@ -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
)
...
...
app/mailers/notify.rb
View file @
51ac77af
...
...
@@ -16,6 +16,7 @@ class Notify < BaseMailer
include
Emails
::
AutoDevops
include
Emails
::
RemoteMirrors
helper
MilestonesHelper
helper
MergeRequestsHelper
helper
DiffHelper
helper
BlobHelper
...
...
app/views/notify/changed_milestone_
issue_
email.html.haml
→
app/views/notify/changed_milestone_email.html.haml
View file @
51ac77af
%p
Milestone changed to
%strong
=
link_to
(
@milestone
.
name
,
@milestone_url
)
-
if
date_range
=
milestone_date_range
(
@milestone
)
=
"(
#{
date_range
}
)"
app/views/notify/changed_milestone_email.text.erb
0 → 100644
View file @
51ac77af
Milestone changed to
<%=
@milestone
.
name
%><%
if
date_range
=
milestone_date_range
(
@milestone
)
%>
(
<%=
date_range
%>
)
<%
end
%>
(
<%=
@milestone_url
%>
)
app/views/notify/changed_milestone_issue_email.text.erb
deleted
100644 → 0
View file @
62d250ff
Milestone changed to
<%=
@milestone
.
name
%>
(
<%=
@milestone_url
%>
)
app/views/notify/changed_milestone_merge_request_email.html.haml
deleted
100644 → 0
View file @
62d250ff
%p
Milestone changed to
%strong
=
link_to
(
@milestone
.
name
,
@milestone_url
)
app/views/notify/changed_milestone_merge_request_email.text.erb
deleted
100644 → 0
View file @
62d250ff
Milestone changed to
<%=
@milestone
.
name
%>
(
<%=
@milestone_url
%>
)
spec/views/notify/changed_milestone_email.html.haml_spec.rb
0 → 100644
View file @
51ac77af
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment