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
c2ac5bc3
Commit
c2ac5bc3
authored
Mar 31, 2020
by
Aakriti Gupta
Committed by
Bob Van Landuyt
Mar 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use CreatedAtFilter in GroupMemberFinder
parent
760c9334
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
app/finders/group_members_finder.rb
app/finders/group_members_finder.rb
+9
-4
app/models/members/group_member.rb
app/models/members/group_member.rb
+1
-0
No files found.
app/finders/group_members_finder.rb
View file @
c2ac5bc3
# frozen_string_literal: true
# frozen_string_literal: true
class
GroupMembersFinder
<
UnionFinder
class
GroupMembersFinder
<
UnionFinder
include
CreatedAtFilter
# Params can be any of the following:
# Params can be any of the following:
# two_factor: string. 'enabled' or 'disabled' are returning different set of data, other values are not effective.
# two_factor: string. 'enabled' or 'disabled' are returning different set of data, other values are not effective.
# sort: string
# sort: string
# search: string
# search: string
# created_after: datetime
# created_before: datetime
def
initialize
(
group
,
user
=
nil
)
def
initialize
(
group
,
user
=
nil
)
@group
=
group
@group
=
group
...
@@ -15,6 +19,7 @@ class GroupMembersFinder < UnionFinder
...
@@ -15,6 +19,7 @@ class GroupMembersFinder < UnionFinder
def
execute
(
include_relations:
[
:inherited
,
:direct
],
params:
{})
def
execute
(
include_relations:
[
:inherited
,
:direct
],
params:
{})
group_members
=
group
.
members
group_members
=
group
.
members
relations
=
[]
relations
=
[]
@params
=
params
return
group_members
if
include_relations
==
[
:direct
]
return
group_members
if
include_relations
==
[
:direct
]
...
@@ -39,15 +44,15 @@ class GroupMembersFinder < UnionFinder
...
@@ -39,15 +44,15 @@ class GroupMembersFinder < UnionFinder
return
GroupMember
.
none
if
relations
.
empty?
return
GroupMember
.
none
if
relations
.
empty?
members
=
find_union
(
relations
,
GroupMember
)
members
=
find_union
(
relations
,
GroupMember
)
filter_members
(
members
,
params
)
filter_members
(
members
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
private
private
attr_reader
:user
,
:group
attr_reader
:user
,
:group
,
:params
def
filter_members
(
members
,
params
)
def
filter_members
(
members
)
members
=
members
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
members
=
members
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
members
=
members
.
sort_by_attribute
(
params
[
:sort
])
if
params
[
:sort
].
present?
members
=
members
.
sort_by_attribute
(
params
[
:sort
])
if
params
[
:sort
].
present?
...
@@ -55,7 +60,7 @@ class GroupMembersFinder < UnionFinder
...
@@ -55,7 +60,7 @@ class GroupMembersFinder < UnionFinder
members
=
members
.
filter_by_2fa
(
params
[
:two_factor
])
members
=
members
.
filter_by_2fa
(
params
[
:two_factor
])
end
end
members
by_created_at
(
members
)
end
end
def
can_manage_members
def
can_manage_members
...
...
app/models/members/group_member.rb
View file @
c2ac5bc3
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
class
GroupMember
<
Member
class
GroupMember
<
Member
include
FromUnion
include
FromUnion
include
CreatedAtFilterable
SOURCE_TYPE
=
'Namespace'
SOURCE_TYPE
=
'Namespace'
...
...
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