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
Boxiang Sun
gitlab-ce
Commits
58dd4a09
Commit
58dd4a09
authored
Apr 09, 2018
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor `add_recipients`
parent
b8c098ec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+2
-3
No files found.
app/services/notification_recipient_service.rb
View file @
58dd4a09
...
@@ -51,11 +51,10 @@ module NotificationRecipientService
...
@@ -51,11 +51,10 @@ module NotificationRecipientService
def
add_recipients
(
users
,
type
,
reason
)
def
add_recipients
(
users
,
type
,
reason
)
if
users
.
is_a?
(
ActiveRecord
::
Relation
)
if
users
.
is_a?
(
ActiveRecord
::
Relation
)
users
=
users
.
includes
(
:notification_settings
)
.
to_a
users
=
users
.
includes
(
:notification_settings
)
end
end
users
=
Array
(
users
)
users
=
Array
(
users
).
compact
users
.
compact!
recipients
.
concat
(
users
.
map
{
|
u
|
make_recipient
(
u
,
type
,
reason
)
})
recipients
.
concat
(
users
.
map
{
|
u
|
make_recipient
(
u
,
type
,
reason
)
})
end
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