Skip to content
Snippets Groups Projects

Traversal ids queries

Closed Alex Pooley requested to merge traversal-ids-queries into master
7 unresolved threads
19 files
+ 486
168
Compare changes
  • Side-by-side
  • Inline
Files
19
  • 5be8cc4c
    Linear Namespace querying methods · 5be8cc4c
    Alex Pooley authored
    A set of linear Namespace querying methods to replace recursive CTE
    queries. The linear methods are faster and more simple to work with.
@@ -88,7 +88,7 @@ def group_title(group, name = nil, url = nil)
@@ -88,7 +88,7 @@ def group_title(group, name = nil, url = nil)
@has_group_title = true
@has_group_title = true
full_title = []
full_title = []
group.ancestors.reverse.each_with_index do |parent, index|
sorted_ancestors(group).reverse.each_with_index do |parent, index|
if index > 0
if index > 0
add_to_breadcrumb_dropdown(group_title_link(parent, hidable: false, show_avatar: true, for_dropdown: true), location: :before)
add_to_breadcrumb_dropdown(group_title_link(parent, hidable: false, show_avatar: true, for_dropdown: true), location: :before)
else
else
@@ -220,11 +220,20 @@ def remove_the_share_with_group_lock_from_ancestor(group)
@@ -220,11 +220,20 @@ def remove_the_share_with_group_lock_from_ancestor(group)
end
end
def oldest_consecutively_locked_ancestor(group)
def oldest_consecutively_locked_ancestor(group)
group.ancestors.find do |group|
sorted_ancestors(group).find do |group|
!group.has_parent? || !group.parent.share_with_group_lock?
!group.has_parent? || !group.parent.share_with_group_lock?
end
end
end
end
 
# Ancestors sorted by hierarchy depth in bottom-top order.
 
def sorted_ancestors(group)
 
if Feature.enabled?(:linear_groups, group.root_ancestor)
 
group.ancestors.sort_by { |g| g.traversal_ids.length }.reverse
 
else
 
group.ancestors
 
end
 
end
 
def default_help
def default_help
s_("GroupSettings|This setting will be applied to all subgroups unless overridden by a group owner. Groups that already have access to the project will continue to have access unless removed manually.")
s_("GroupSettings|This setting will be applied to all subgroups unless overridden by a group owner. Groups that already have access to the project will continue to have access unless removed manually.")
end
end
Loading