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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
4c9e47f6
Commit
4c9e47f6
authored
11 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix notifications for group projects
parent
3208dad1
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
app/services/notification_service.rb
app/services/notification_service.rb
+8
-8
No files found.
app/services/notification_service.rb
View file @
4c9e47f6
...
...
@@ -147,17 +147,17 @@ class NotificationService
# Get project users with WATCH notification level
def
project_watchers
(
project
)
project_watchers
=
[]
member_methods
=
{
project
=>
:users_projects
}
member_methods
.
merge!
(
project
.
group
=>
:users_groups
)
if
project
.
group
member_methods
=
[
:users_projects
]
member_methods
<<
:users_groups
if
project
.
group
member_methods
.
each
do
|
member_method
|
member_methods
.
each
do
|
object
,
member_method
|
# Get project notification settings since it has higher priority
user_ids
=
pro
ject
.
send
(
member_method
).
where
(
notification_level:
Notification
::
N_WATCH
).
pluck
(
:user_id
)
project_watchers
=
User
.
where
(
id:
user_ids
)
user_ids
=
ob
ject
.
send
(
member_method
).
where
(
notification_level:
Notification
::
N_WATCH
).
pluck
(
:user_id
)
project_watchers
+
=
User
.
where
(
id:
user_ids
)
# next collect users who use global settings with watch state
user_ids
=
pro
ject
.
send
(
member_method
).
where
(
notification_level:
Notification
::
N_GLOBAL
).
pluck
(
:user_id
)
user_ids
=
ob
ject
.
send
(
member_method
).
where
(
notification_level:
Notification
::
N_GLOBAL
).
pluck
(
:user_id
)
project_watchers
+=
User
.
where
(
id:
user_ids
,
notification_level:
Notification
::
N_WATCH
)
end
...
...
@@ -175,7 +175,7 @@ class NotificationService
tm
=
project
.
users_projects
.
find_by_user_id
(
user
.
id
)
if
!
tm
&&
project
.
group
tm
=
project
.
users_groups
.
find_by_user_id
(
user
.
id
)
tm
=
project
.
group
.
users_groups
.
find_by_user_id
(
user
.
id
)
end
# reject users who globally disabled notification and has no membership
...
...
This diff is collapsed.
Click to expand it.
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