summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-05-03 14:49:37 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-05-17 20:53:16 +0200
commit34974258bc3f745c86512319231bad47232fe007 (patch)
treea6b9b7d7a80282f77471302f0970daced62e0455 /app
parentac382b5682dc2d5eea750313c59fb2581af13326 (diff)
downloadgitlab-ce-34974258bc3f745c86512319231bad47232fe007.tar.gz
Hide nested group UI/API support for MySQL
This hides/disables some UI elements and API parameters related to nested groups when MySQL is used, since nested groups are not supported for MySQL.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/groups_controller.rb2
-rw-r--r--app/models/namespace.rb4
-rw-r--r--app/models/user.rb2
-rw-r--r--app/views/groups/_show_nav.html.haml7
4 files changed, 7 insertions, 8 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 1515173d0ac..26a4b884c3a 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -64,6 +64,8 @@ class GroupsController < Groups::ApplicationController
end
def subgroups
+ return not_found unless Group.supports_nested_groups?
+
@nested_groups = GroupsFinder.new(current_user, parent: group).execute
@nested_groups = @nested_groups.search(params[:filter_groups]) if params[:filter_groups].present?
end
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 985395a6fe2..5ceb3d0aee6 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -178,7 +178,7 @@ class Namespace < ActiveRecord::Base
# Returns all the ancestors of the current namespaces.
def ancestors
- return self.class.none if !Group.supports_nested_groups? || !parent_id
+ return self.class.none unless parent_id
Gitlab::GroupHierarchy.
new(self.class.where(id: parent_id)).
@@ -187,8 +187,6 @@ class Namespace < ActiveRecord::Base
# Returns all the descendants of the current namespace.
def descendants
- return self.class.none unless Group.supports_nested_groups?
-
Gitlab::GroupHierarchy.
new(self.class.where(parent_id: id)).
base_and_descendants
diff --git a/app/models/user.rb b/app/models/user.rb
index 2cf995f8c31..149a80b6083 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -509,8 +509,6 @@ class User < ActiveRecord::Base
# Returns a relation of groups the user has access to, including their parent
# and child groups (recursively).
def all_expanded_groups
- return groups unless Group.supports_nested_groups?
-
Gitlab::GroupHierarchy.new(groups).all_groups
end
diff --git a/app/views/groups/_show_nav.html.haml b/app/views/groups/_show_nav.html.haml
index b2097e88741..35b75bc0923 100644
--- a/app/views/groups/_show_nav.html.haml
+++ b/app/views/groups/_show_nav.html.haml
@@ -2,6 +2,7 @@
= nav_link(page: group_path(@group)) do
= link_to group_path(@group) do
Projects
- = nav_link(page: subgroups_group_path(@group)) do
- = link_to subgroups_group_path(@group) do
- Subgroups
+ - if Group.supports_nested_groups?
+ = nav_link(page: subgroups_group_path(@group)) do
+ = link_to subgroups_group_path(@group) do
+ Subgroups