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
f93c4dc0
Commit
f93c4dc0
authored
Mar 26, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use notificationService for MR reassigned
parent
38ffb822
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
app/observers/merge_request_observer.rb
app/observers/merge_request_observer.rb
+3
-12
app/services/notification_service.rb
app/services/notification_service.rb
+16
-2
No files found.
app/observers/merge_request_observer.rb
View file @
f93c4dc0
...
...
@@ -6,29 +6,20 @@ class MergeRequestObserver < ActiveRecord::Observer
end
def
after_close
(
merge_request
,
transition
)
send_reassigned_email
(
merge_request
)
if
merge_request
.
is_being_reassigned?
Note
.
create_status_change_note
(
merge_request
,
current_user
,
merge_request
.
state
)
end
def
after_reopen
(
merge_request
,
transition
)
send_reassigned_email
(
merge_request
)
if
merge_request
.
is_being_reassigned?
Note
.
create_status_change_note
(
merge_request
,
current_user
,
merge_request
.
state
)
end
def
after_update
(
merge_request
)
send_reassigned_email
(
merge_request
)
if
merge_request
.
is_being_reassigned?
notification
.
reassigned_merge_request
(
merge_request
)
if
merge_request
.
is_being_reassigned?
end
protected
def
send_reassigned_email
(
merge_request
)
recipients_ids
=
merge_request
.
assignee_id_was
,
merge_request
.
assignee_id
recipients_ids
.
delete
current_user
.
id
recipients_ids
.
each
do
|
recipient_id
|
Notify
.
delay
.
reassigned_merge_request_email
(
recipient_id
,
merge_request
.
id
,
merge_request
.
assignee_id_was
)
end
def
notification
NotificationService
.
new
end
end
app/services/notification_service.rb
View file @
f93c4dc0
...
...
@@ -33,8 +33,8 @@ class NotificationService
# When we reassign an issue we should send next emails:
#
# * issue
author
if his notification level is not Disabled
# * issue assignee if his notification level is not Disabled
# * issue
old assignee
if his notification level is not Disabled
# * issue
new
assignee if his notification level is not Disabled
#
def
reassigned_issue
(
issue
,
current_user
)
recipient_ids
=
[
issue
.
assignee_id
,
issue
.
assignee_id_was
].
compact
.
uniq
...
...
@@ -66,4 +66,18 @@ class NotificationService
Notify
.
delay
.
new_merge_request_email
(
merge_request
.
id
)
end
end
# When we reassign a merge_request we should send next emails:
#
# * merge_request old assignee if his notification level is not Disabled
# * merge_request assignee if his notification level is not Disabled
#
def
reassigned_merge_request
(
merge_request
,
current_user
)
recipients_ids
=
merge_request
.
assignee_id_was
,
merge_request
.
assignee_id
recipients_ids
.
delete
current_user
.
id
recipients_ids
.
each
do
|
recipient_id
|
Notify
.
delay
.
reassigned_merge_request_email
(
recipient_id
,
merge_request
.
id
,
merge_request
.
assignee_id_was
)
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