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
76630665
Commit
76630665
authored
Apr 26, 2021
by
Imre Farkas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add use_traversal_ids_for_ancestors feature flag
parent
109771dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
app/models/namespaces/traversal/linear.rb
app/models/namespaces/traversal/linear.rb
+1
-0
config/feature_flags/development/use_traversal_ids_for_ancestors.yml
...ure_flags/development/use_traversal_ids_for_ancestors.yml
+8
-0
spec/models/group_spec.rb
spec/models/group_spec.rb
+11
-3
No files found.
app/models/namespaces/traversal/linear.rb
View file @
76630665
...
...
@@ -66,6 +66,7 @@ module Namespaces
def
ancestors
(
hierarchy_order:
nil
)
return
super
()
unless
use_traversal_ids?
return
super
()
unless
Feature
.
enabled?
(
:use_traversal_ids_for_ancestors
,
root_ancestor
,
default_enabled: :yaml
)
return
self
.
class
.
none
if
parent_id
.
blank?
...
...
config/feature_flags/development/use_traversal_ids_for_ancestors.yml
0 → 100644
View file @
76630665
---
name
:
use_traversal_ids_for_ancestors
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/324749
rollout_issue_url
:
milestone
:
'
13.12'
type
:
development
group
:
group::access
default_enabled
:
false
spec/models/group_spec.rb
View file @
76630665
...
...
@@ -455,10 +455,18 @@ RSpec.describe Group do
describe
'#ancestors'
do
it
{
expect
(
group
.
ancestors
.
to_sql
).
to
include
'traversal_ids <@'
}
end
it
'hierarchy order'
do
expect
(
group
.
ancestors
(
hierarchy_order: :asc
).
to_sql
).
to
include
'ORDER BY "depth" ASC'
it
'hierarchy order'
do
expect
(
group
.
ancestors
(
hierarchy_order: :asc
).
to_sql
).
to
include
'ORDER BY "depth" ASC'
end
context
'ancestor linear queries feature flag disabled'
do
before
do
stub_feature_flags
(
use_traversal_ids_for_ancestors:
false
)
end
it
{
expect
(
group
.
ancestors
.
to_sql
).
not_to
include
'traversal_ids <@'
}
end
end
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