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
Léo-Paul Géneau
gitlab-ce
Commits
4c9e47f6
Commit
4c9e47f6
authored
Jun 21, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix notifications for group projects
parent
3208dad1
Changes
1
Show 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
...
@@ -147,17 +147,17 @@ class NotificationService
# Get project users with WATCH notification level
# Get project users with WATCH notification level
def
project_watchers
(
project
)
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
.
each
do
|
object
,
member_method
|
member_methods
<<
:users_groups
if
project
.
group
member_methods
.
each
do
|
member_method
|
# Get project notification settings since it has higher priority
# 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
)
user_ids
=
ob
ject
.
send
(
member_method
).
where
(
notification_level:
Notification
::
N_WATCH
).
pluck
(
:user_id
)
project_watchers
=
User
.
where
(
id:
user_ids
)
project_watchers
+
=
User
.
where
(
id:
user_ids
)
# next collect users who use global settings with watch state
# 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
)
project_watchers
+=
User
.
where
(
id:
user_ids
,
notification_level:
Notification
::
N_WATCH
)
end
end
...
@@ -175,7 +175,7 @@ class NotificationService
...
@@ -175,7 +175,7 @@ class NotificationService
tm
=
project
.
users_projects
.
find_by_user_id
(
user
.
id
)
tm
=
project
.
users_projects
.
find_by_user_id
(
user
.
id
)
if
!
tm
&&
project
.
group
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
end
# reject users who globally disabled notification and has no membership
# reject users who globally disabled notification and has no membership
...
...
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