Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-05-30 11:53:00 +0300
committerAlfredo Sumaran <alfredo@gitlab.com>2017-05-30 11:53:00 +0300
commitfb1e7eae99b4246ee901075d52fe14a4b760654e (patch)
treecd0caacba0b9126f4d391824d809cefd9db4fd78 /app/serializers/group_entity.rb
parent5e9378961f748c5862acdf74d6d476f96c6f65c7 (diff)
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.
Diffstat (limited to 'app/serializers/group_entity.rb')
-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