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
Jérome Perrin
gitlab-ce
Commits
798873ca
Commit
798873ca
authored
Nov 09, 2015
by
adamliesko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add notification to the former assignee upon unassignment
parent
62769e20
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
CHANGELOG
CHANGELOG
+1
-0
app/services/notification_service.rb
app/services/notification_service.rb
+4
-2
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+6
-4
No files found.
CHANGELOG
View file @
798873ca
...
...
@@ -26,6 +26,7 @@ v 8.2.0 (unreleased)
- Add "added", "modified" and "removed" properties to commit object in webhook
- Rename "Back to" links to "Go to" because its not always a case it point to place user come from
- Allow groups to appear in the search results if the group owner allows it
- Add email notification to former assignee upon unassignment
v 8.1.3
- Spread out runner contacted_at updates
...
...
app/services/notification_service.rb
View file @
798873ca
...
...
@@ -362,7 +362,8 @@ class NotificationService
def
reassign_resource_email
(
target
,
project
,
current_user
,
method
)
assignee_id_was
=
previous_record
(
target
,
"assignee_id"
)
recipients
=
build_recipients
(
target
,
project
,
current_user
)
previous_assignee
=
User
.
find
(
assignee_id_was
)
recipients
=
build_recipients
(
target
,
project
,
current_user
,
[
previous_assignee
])
recipients
.
each
do
|
recipient
|
mailer
.
send
(
method
,
recipient
.
id
,
target
.
id
,
assignee_id_was
,
current_user
.
id
)
...
...
@@ -377,8 +378,9 @@ class NotificationService
end
end
def
build_recipients
(
target
,
project
,
current_user
)
def
build_recipients
(
target
,
project
,
current_user
,
previous_records
=
nil
)
recipients
=
target
.
participants
(
current_user
)
recipients
.
concat
(
previous_records
).
compact
.
uniq
if
previous_records
recipients
=
add_project_watchers
(
recipients
,
project
)
recipients
=
reject_mention_users
(
recipients
,
project
)
...
...
spec/services/issues/update_service_spec.rb
View file @
798873ca
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Issues
::
UpdateService
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
title:
'Old title'
)
}
let
(
:issue
)
{
create
(
:issue
,
title:
'Old title'
,
assignee_id:
user
.
id
)
}
let
(
:label
)
{
create
(
:label
)
}
let
(
:project
)
{
issue
.
project
}
...
...
@@ -34,9 +34,11 @@ describe Issues::UpdateService do
it
{
expect
(
@issue
.
labels
.
count
).
to
eq
(
1
)
}
it
{
expect
(
@issue
.
labels
.
first
.
title
).
to
eq
(
'Bug'
)
}
it
'should send email to user2 about assign of new issue'
do
email
=
ActionMailer
::
Base
.
deliveries
.
last
expect
(
email
.
to
.
first
).
to
eq
(
user2
.
email
)
it
'should send email to user2 about assign of new issue and email to user about issue unassignment'
do
deliveries
=
ActionMailer
::
Base
.
deliveries
email
=
deliveries
.
last
recipients
=
deliveries
.
map
(
&
:to
).
uniq
.
flatten
expect
(
recipients
.
last
(
2
)).
to
include
(
user
.
email
,
user2
.
email
)
expect
(
email
.
subject
).
to
include
(
issue
.
title
)
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