diff options
author | Stan Hu <stanhu@gmail.com> | 2017-11-19 16:02:46 -0800 |
---|---|---|
committer | Francisco Lopez <fjlopez@gitlab.com> | 2017-12-01 18:32:12 +0100 |
commit | 02cd1702b27ddb15f15f7efeb5ce60412492e41d (patch) | |
tree | 0b56063860df002166274fe5ce381b189d15a654 | |
parent | 39d293abd2ec135c53448552d482d17f9726701c (diff) | |
download | gitlab-ce-02cd1702b27ddb15f15f7efeb5ce60412492e41d.tar.gz |
Only serialize namespace essentials in group's projects API response
-rw-r--r-- | lib/api/entities.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index ca7708e366e..5b9b0afed0f 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -146,7 +146,7 @@ module API expose :shared_runners_enabled expose :lfs_enabled?, as: :lfs_enabled expose :creator_id - expose :namespace, using: 'API::Entities::Namespace' + expose :namespace, using: 'API::Entities::NamespaceBasic' expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? } expose :import_status expose :import_error, if: lambda { |_project, options| options[:user_can_admin_project] } @@ -618,9 +618,11 @@ module API expose :created_at end - class Namespace < Grape::Entity + class NamespaceBasic < Grape::Entity expose :id, :name, :path, :kind, :full_path, :parent_id + end + class Namespace < NamespaceBasic expose :members_count_with_descendants, if: -> (namespace, opts) { expose_members_count_with_descendants?(namespace, opts) } do |namespace, _| namespace.users_with_descendants.count end |