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
0d6374ac
Commit
0d6374ac
authored
Jul 05, 2018
by
Jacopo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uses .includes(:user).references(:user) only when needed
parent
42f78e91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
lib/api/helpers/members_helpers.rb
lib/api/helpers/members_helpers.rb
+4
-5
lib/api/members.rb
lib/api/members.rb
+1
-1
No files found.
lib/api/helpers/members_helpers.rb
View file @
0d6374ac
...
...
@@ -13,16 +13,15 @@ module API
def
find_all_members
(
source_type
,
source
)
members
=
(
source_type
==
'project'
)
?
find_all_members_for_project
(
source
)
:
find_all_members_for_group
(
source
)
members
.
references
(
:user
).
non_invite
.
non_request
.
select
(
%w[members.expires_at members.access_level users.*]
)
members
.
non_invite
.
non_request
end
def
find_all_members_for_project
(
project
)
shared_group_ids
=
project
.
project_group_links
.
pluck
(
:group_id
)
source_ids
=
[
project
.
id
,
project
.
group
&
.
id
].
concat
(
shared_group_ids
).
compact
Member
.
includes
(
user: :project_authorizations
).
Member
.
includes
(
:user
).
joins
(
user: :project_authorizations
).
where
(
project_authorizations:
{
project_id:
project
.
id
}).
where
(
source_id:
source_ids
)
end
...
...
lib/api/members.rb
View file @
0d6374ac
...
...
@@ -39,7 +39,7 @@ module API
source
=
find_source
(
source_type
,
params
[
:id
])
members
=
find_all_members
(
source_type
,
source
)
members
=
members
.
merge
(
User
.
search
(
params
[
:query
]))
if
params
[
:query
].
present?
members
=
members
.
references
(
:user
).
merge
(
User
.
search
(
params
[
:query
]))
if
params
[
:query
].
present?
members
=
paginate
(
members
)
present
members
,
with:
Entities
::
Member
...
...
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