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
Kazuhiko Shiozaki
gitlab-ce
Commits
8c308e3d
Commit
8c308e3d
authored
Nov 17, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't fail when there was no previous assignee
parent
1ca55082
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
app/services/notification_service.rb
app/services/notification_service.rb
+10
-8
No files found.
app/services/notification_service.rb
View file @
8c308e3d
...
@@ -361,12 +361,13 @@ class NotificationService
...
@@ -361,12 +361,13 @@ class NotificationService
end
end
def
reassign_resource_email
(
target
,
project
,
current_user
,
method
)
def
reassign_resource_email
(
target
,
project
,
current_user
,
method
)
assignee_id_was
=
previous_record
(
target
,
"assignee_id"
)
previous_assignee_id
=
previous_record
(
target
,
"assignee_id"
)
previous_assignee
=
User
.
find
(
assignee_id_was
)
previous_assignee
=
User
.
find_by
(
id:
previous_assignee_id
)
if
previous_assignee_id
recipients
=
build_recipients
(
target
,
project
,
current_user
,
[
previous_assignee
])
recipients
=
build_recipients
(
target
,
project
,
current_user
,
[
previous_assignee
])
recipients
.
each
do
|
recipient
|
recipients
.
each
do
|
recipient
|
mailer
.
send
(
method
,
recipient
.
id
,
target
.
id
,
assignee_id_was
,
current_user
.
id
)
mailer
.
send
(
method
,
recipient
.
id
,
target
.
id
,
previous_assignee_id
,
current_user
.
id
)
end
end
end
end
...
@@ -378,9 +379,10 @@ class NotificationService
...
@@ -378,9 +379,10 @@ class NotificationService
end
end
end
end
def
build_recipients
(
target
,
project
,
current_user
,
previous_record
s
=
nil
)
def
build_recipients
(
target
,
project
,
current_user
,
extra_recipient
s
=
nil
)
recipients
=
target
.
participants
(
current_user
)
recipients
=
target
.
participants
(
current_user
)
recipients
.
concat
(
previous_records
).
compact
.
uniq
if
previous_records
recipients
=
recipients
.
concat
(
extra_recipients
).
compact
.
uniq
if
extra_recipients
recipients
=
add_project_watchers
(
recipients
,
project
)
recipients
=
add_project_watchers
(
recipients
,
project
)
recipients
=
reject_mention_users
(
recipients
,
project
)
recipients
=
reject_mention_users
(
recipients
,
project
)
...
...
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