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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
fb86ec51
Commit
fb86ec51
authored
May 15, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move stuff around a bit in NotifictionService.
parent
07fd736d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
app/services/notification_service.rb
app/services/notification_service.rb
+15
-8
No files found.
app/services/notification_service.rb
View file @
fb86ec51
...
...
@@ -91,10 +91,14 @@ class NotificationService
# * project team members with notification level higher then Participating
#
def
merge_mr
(
merge_request
,
current_user
)
recipients
=
reject_muted_users
([
merge_request
.
author
,
merge_request
.
assignee
],
merge_request
.
target_project
)
recipients
=
[
merge_request
.
author
,
merge_request
.
assignee
]
recipients
=
add_project_watchers
(
recipients
,
merge_request
.
target_project
)
recipients
=
reject_muted_users
(
recipients
,
merge_request
.
target_project
)
recipients
=
add_subscribed_users
(
recipients
,
merge_request
)
recipients
=
reject_unsubscribed_users
(
recipients
,
merge_request
)
recipients
=
recipients
.
concat
(
project_watchers
(
merge_request
.
target_project
)).
uniq
recipients
.
delete
(
current_user
)
recipients
.
each
do
|
recipient
|
...
...
@@ -137,20 +141,17 @@ class NotificationService
recipients
=
recipients
.
concat
(
participants
)
# Merge project watchers
recipients
=
recipients
.
concat
(
project_watchers
(
note
.
project
)).
compact
.
uniq
recipients
=
add_project_watchers
(
recipients
,
note
.
project
)
# Reject users with Mention notification level, except those mentioned in _this_ note.
recipients
=
reject_mention_users
(
recipients
-
note
.
mentioned_users
,
note
.
project
)
recipients
=
recipients
+
note
.
mentioned_users
# Reject mutes users
recipients
=
reject_muted_users
(
recipients
,
note
.
project
)
recipients
=
add_subscribed_users
(
recipients
,
note
.
noteable
)
recipients
=
reject_unsubscribed_users
(
recipients
,
note
.
noteable
)
# Reject author
recipients
.
delete
(
note
.
author
)
# build notify method like 'note_commit_email'
...
...
@@ -287,6 +288,10 @@ class NotificationService
users
end
def
add_project_watchers
(
recipients
,
project
)
recipients
.
concat
(
project_watchers
(
project
)).
compact
.
uniq
end
# Remove users with disabled notifications from array
# Also remove duplications and nil recipients
def
reject_muted_users
(
users
,
project
=
nil
)
...
...
@@ -403,11 +408,13 @@ class NotificationService
[
target
.
author
,
target
.
assignee
]
end
recipients
=
reject_muted_users
(
recipients
,
project
)
recipients
=
add_project_watchers
(
recipients
)
recipients
=
reject_mention_users
(
recipients
,
project
)
recipients
=
reject_muted_users
(
recipients
,
project
)
recipients
=
add_subscribed_users
(
recipients
,
target
)
recipients
=
recipients
.
concat
(
project_watchers
(
project
)).
uniq
recipients
=
reject_unsubscribed_users
(
recipients
,
target
)
recipients
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