Commit 889c25eb authored by Bob Van Landuyt's avatar Bob Van Landuyt

Guarantee the order of groups in the dropdown

So the groups with the same parent are listed together.

The recursive cte seemed to do it by itself, but it is not
guaranteed. By ordering on the `route.path` that includes every parent
group, we can assume they're going to be in the right order.
parent 022d8420
......@@ -4,7 +4,10 @@ module NamespacesHelper
end
def namespaces_options(selected = :current_user, display_path: false, extra_group: nil)
groups = current_user.manageable_groups.includes(:route)
groups = current_user.manageable_groups
.joins(:route)
.includes(:route)
.order('routes.path')
users = [current_user.namespace]
unless extra_group.nil? || extra_group.is_a?(Group)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment