summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-05-30 04:24:51 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2017-05-30 04:24:51 -0500
commita9921e9d5d1f4b271b98913cfbc5ed682147d50f (patch)
treefbed763d348ebce3f5a2581d94fdcbeead31b9ba /app
parentd15521c79d86cf163b252ab4be7f8dbb1e5f5879 (diff)
downloadgitlab-ce-a9921e9d5d1f4b271b98913cfbc5ed682147d50f.tar.gz
Expose number_projects and number_users for groups endpoint
Diffstat (limited to 'app')
-rw-r--r--app/serializers/group_entity.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/serializers/group_entity.rb b/app/serializers/group_entity.rb
index 1043b3c69d8..9a455cf55c9 100644
--- a/app/serializers/group_entity.rb
+++ b/app/serializers/group_entity.rb
@@ -1,4 +1,5 @@
class GroupEntity < Grape::Entity
+ include ActionView::Helpers::NumberHelper
include RequestAwareEntity
include MembersHelper
@@ -30,4 +31,12 @@ class GroupEntity < Grape::Entity
expose :has_subgroups do |group|
group.children.any?
end
+
+ expose :number_projects do |group|
+ number_with_delimiter(group.projects.non_archived.count)
+ end
+
+ expose :number_users do |group|
+ number_with_delimiter(group.users.count)
+ end
end