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
ff0125e3
Commit
ff0125e3
authored
Dec 03, 2021
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use linear versions of descendants in GroupDescendantsFinder
parent
adddc040
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
201 additions
and
170 deletions
+201
-170
app/finders/group_descendants_finder.rb
app/finders/group_descendants_finder.rb
+14
-4
config/feature_flags/development/linear_group_descendants_finder.yml
...ure_flags/development/linear_group_descendants_finder.yml
+8
-0
spec/finders/group_descendants_finder_spec.rb
spec/finders/group_descendants_finder_spec.rb
+179
-166
No files found.
app/finders/group_descendants_finder.rb
View file @
ff0125e3
...
...
@@ -87,9 +87,13 @@ class GroupDescendantsFinder
visible_to_user
=
visible_to_user
.
or
(
authorized_to_user
)
end
hierarchy_for_parent
.
descendants
.
where
(
visible_to_user
)
group_to_query
=
if
Feature
.
enabled?
(
:linear_group_descendants_finder
,
current_user
,
default_enabled: :yaml
)
parent_group
else
hierarchy_for_parent
end
group_to_query
.
descendants
.
where
(
visible_to_user
)
# rubocop: enable CodeReuse/Finder
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
@@ -155,7 +159,13 @@ class GroupDescendantsFinder
# rubocop: disable CodeReuse/ActiveRecord
def
projects_matching_filter
# rubocop: disable CodeReuse/Finder
projects_nested_in_group
=
Project
.
where
(
namespace_id:
hierarchy_for_parent
.
base_and_descendants
.
select
(
:id
))
objects_in_hierarchy
=
if
Feature
.
enabled?
(
:linear_group_descendants_finder
,
current_user
,
default_enabled: :yaml
)
parent_group
.
self_and_descendants
.
as_ids
else
hierarchy_for_parent
.
base_and_descendants
.
select
(
:id
)
end
projects_nested_in_group
=
Project
.
where
(
namespace_id:
objects_in_hierarchy
)
params_with_search
=
params
.
merge
(
search:
params
[
:filter
])
ProjectsFinder
.
new
(
params:
params_with_search
,
...
...
config/feature_flags/development/linear_group_descendants_finder.yml
0 → 100644
View file @
ff0125e3
---
name
:
linear_group_descendants_finder
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68954
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/339440
milestone
:
'
14.6'
type
:
development
group
:
group::access
default_enabled
:
false
spec/finders/group_descendants_finder_spec.rb
View file @
ff0125e3
This diff is collapsed.
Click to expand it.
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