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
488e8e79
Commit
488e8e79
authored
Jul 31, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
force queries to include notification settings
parent
3c56e414
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+11
-2
No files found.
app/services/notification_recipient_service.rb
View file @
488e8e79
...
@@ -50,11 +50,20 @@ module NotificationRecipientService
...
@@ -50,11 +50,20 @@ module NotificationRecipientService
def
<<
(
arg
)
def
<<
(
arg
)
users
,
type
=
arg
users
,
type
=
arg
if
users
.
is_a?
(
ActiveRecord
::
Relation
)
users
=
users
.
includes
(
:notification_settings
)
end
users
=
Array
(
users
)
users
=
Array
(
users
)
users
.
compact!
users
.
compact!
recipients
.
concat
(
users
.
map
{
|
u
|
make_recipient
(
u
,
type
)
})
recipients
.
concat
(
users
.
map
{
|
u
|
make_recipient
(
u
,
type
)
})
end
end
def
user_scope
User
.
includes
(
:notification_settings
)
end
def
make_recipient
(
user
,
type
)
def
make_recipient
(
user
,
type
)
NotificationRecipient
.
new
(
NotificationRecipient
.
new
(
user
,
type
,
user
,
type
,
...
@@ -114,7 +123,7 @@ module NotificationRecipientService
...
@@ -114,7 +123,7 @@ module NotificationRecipientService
global_users_ids
=
user_ids_with_project_level_global
.
concat
(
user_ids_with_group_level_global
)
global_users_ids
=
user_ids_with_project_level_global
.
concat
(
user_ids_with_group_level_global
)
user_ids
+=
user_ids_with_global_level_custom
(
global_users_ids
,
custom_action
)
user_ids
+=
user_ids_with_global_level_custom
(
global_users_ids
,
custom_action
)
self
<<
[
User
.
find
(
user_ids
),
:watch
]
self
<<
[
user_scope
.
where
(
id:
user_ids
),
:watch
]
end
end
def
add_project_watchers
def
add_project_watchers
...
@@ -133,7 +142,7 @@ module NotificationRecipientService
...
@@ -133,7 +142,7 @@ module NotificationRecipientService
user_ids_with_project_setting
=
select_project_members_ids
(
project
,
user_ids_with_project_global
,
user_ids
)
user_ids_with_project_setting
=
select_project_members_ids
(
project
,
user_ids_with_project_global
,
user_ids
)
user_ids_with_group_setting
=
select_group_members_ids
(
project
.
group
,
project_members_ids
,
user_ids_with_group_global
,
user_ids
)
user_ids_with_group_setting
=
select_group_members_ids
(
project
.
group
,
project_members_ids
,
user_ids_with_group_global
,
user_ids
)
User
.
where
(
id:
user_ids_with_project_setting
.
concat
(
user_ids_with_group_setting
).
uniq
).
to_a
user_scope
.
where
(
id:
user_ids_with_project_setting
.
concat
(
user_ids_with_group_setting
).
uniq
)
end
end
def
add_subscribed_users
def
add_subscribed_users
...
...
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