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
efe96293
Commit
efe96293
authored
Apr 15, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Mention notification level.
parent
80097606
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
24 deletions
+13
-24
app/services/notification_service.rb
app/services/notification_service.rb
+13
-24
No files found.
app/services/notification_service.rb
View file @
efe96293
...
@@ -130,22 +130,23 @@ class NotificationService
...
@@ -130,22 +130,23 @@ class NotificationService
if
note
.
commit_id
.
present?
if
note
.
commit_id
.
present?
recipients
<<
note
.
commit_author
recipients
<<
note
.
commit_author
end
end
# Get users who left comment in thread
# Add all users participating in the thread (author, assignee, comment authors)
recipients
=
recipients
.
concat
(
noteable_commenters
(
note
))
participants
=
if
target
.
is_a?
(
Commit
)
author_ids
=
Note
.
for_commit_id
(
target
.
id
).
pluck
(
:author_id
).
uniq
User
.
where
(
id:
author_ids
)
else
target
.
participants
end
recipients
=
recipients
.
concat
(
participants
)
# Merge project watchers
# Merge project watchers
recipients
=
recipients
.
concat
(
project_watchers
(
note
.
project
)).
compact
.
uniq
recipients
=
recipients
.
concat
(
project_watchers
(
note
.
project
)).
compact
.
uniq
# Reject users with Mention notification level
# Reject users with Mention notification level, except those mentioned in _this_ note.
recipients
=
reject_mention_users
(
recipients
,
note
.
project
)
recipients
=
reject_mention_users
(
recipients
-
note
.
mentioned_users
,
note
.
project
)
recipients
=
recipients
+
note
.
mentioned_users
# Add explicitly mentioned users
if
target
.
respond_to?
(
:participants
)
recipients
=
recipients
.
concat
(
target
.
participants
)
else
recipients
=
recipients
.
concat
(
note
.
mentioned_users
)
end
# Reject mutes users
# Reject mutes users
recipients
=
reject_muted_users
(
recipients
,
note
.
project
)
recipients
=
reject_muted_users
(
recipients
,
note
.
project
)
...
@@ -216,18 +217,6 @@ class NotificationService
...
@@ -216,18 +217,6 @@ class NotificationService
protected
protected
def
noteable_commenters
(
note
)
opts
=
{
noteable_type:
note
.
noteable_type
,
project_id:
note
.
project_id
}
if
note
.
commit_id
.
present?
opts
.
merge!
(
commit_id:
note
.
commit_id
)
else
opts
.
merge!
(
noteable_id:
note
.
noteable_id
)
end
User
.
where
(
id:
Note
.
where
(
opts
).
pluck
(
:author_id
))
end
# Get project users with WATCH notification level
# Get project users with WATCH notification level
def
project_watchers
(
project
)
def
project_watchers
(
project
)
project_members
=
project_member_notification
(
project
)
project_members
=
project_member_notification
(
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