summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-05-30 03:53:00 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2017-05-30 03:53:00 -0500
commitfb1e7eae99b4246ee901075d52fe14a4b760654e (patch)
treecd0caacba0b9126f4d391824d809cefd9db4fd78
parent5e9378961f748c5862acdf74d6d476f96c6f65c7 (diff)
downloadgitlab-ce-fb1e7eae99b4246ee901075d52fe14a4b760654e.tar.gz
Expose has_subgroups for groups endpoint
This is needed because we have to know before hand if the group has subgroups. If the group doesn’t have subgroups we will not let the user to click a group row to fetch subgroups, also we will hide caret icon which is used to indicate the row can be expanded.
-rw-r--r--app/serializers/group_entity.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/serializers/group_entity.rb b/app/serializers/group_entity.rb
index eee8409b1d1..1043b3c69d8 100644
--- a/app/serializers/group_entity.rb
+++ b/app/serializers/group_entity.rb
@@ -26,4 +26,8 @@ class GroupEntity < Grape::Entity
expose :can_edit do |group|
can?(request.current_user, :admin_group, group)
end
+
+ expose :has_subgroups do |group|
+ group.children.any?
+ end
end