Merge branch 'dm-simple-project-avatar-url' into 'master'
Expose avatar_url when requesting list of projects from API with simple=true See merge request gitlab-org/gitlab-ce!14498
This commit is contained in:
commit
6d1498ab4e
5 changed files with 14 additions and 5 deletions
5
changelogs/unreleased/dm-simple-project-avatar-url.yml
Normal file
5
changelogs/unreleased/dm-simple-project-avatar-url.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Expose avatar_url when requesting list of projects from API with simple=true
|
||||
merge_request:
|
||||
author:
|
||||
type: added
|
|
@ -89,6 +89,9 @@ module API
|
|||
expose :ssh_url_to_repo, :http_url_to_repo, :web_url
|
||||
expose :name, :name_with_namespace
|
||||
expose :path, :path_with_namespace
|
||||
expose :avatar_url do |project, options|
|
||||
project.avatar_url(only_path: false)
|
||||
end
|
||||
expose :star_count, :forks_count
|
||||
expose :created_at, :last_activity_at
|
||||
end
|
||||
|
@ -146,9 +149,7 @@ module API
|
|||
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] }
|
||||
expose :avatar_url do |user, options|
|
||||
user.avatar_url(only_path: false)
|
||||
end
|
||||
|
||||
expose :open_issues_count, if: lambda { |project, options| project.feature_available?(:issues, options[:current_user]) }
|
||||
expose :runners_token, if: lambda { |_project, options| options[:user_can_admin_project] }
|
||||
expose :public_builds, as: :public_jobs
|
||||
|
@ -193,8 +194,8 @@ module API
|
|||
class Group < Grape::Entity
|
||||
expose :id, :name, :path, :description, :visibility
|
||||
expose :lfs_enabled?, as: :lfs_enabled
|
||||
expose :avatar_url do |user, options|
|
||||
user.avatar_url(only_path: false)
|
||||
expose :avatar_url do |group, options|
|
||||
group.avatar_url(only_path: false)
|
||||
end
|
||||
expose :web_url
|
||||
expose :request_access_enabled
|
||||
|
|
|
@ -20,6 +20,7 @@ describe API::Environments do
|
|||
path path_with_namespace
|
||||
star_count forks_count
|
||||
created_at last_activity_at
|
||||
avatar_url
|
||||
)
|
||||
|
||||
get api("/projects/#{project.id}/environments", user)
|
||||
|
|
|
@ -193,6 +193,7 @@ describe API::Projects do
|
|||
path path_with_namespace
|
||||
star_count forks_count
|
||||
created_at last_activity_at
|
||||
avatar_url
|
||||
)
|
||||
|
||||
get api('/projects?simple=true', user)
|
||||
|
|
|
@ -89,6 +89,7 @@ describe API::V3::Projects do
|
|||
path path_with_namespace
|
||||
star_count forks_count
|
||||
created_at last_activity_at
|
||||
avatar_url
|
||||
)
|
||||
|
||||
get v3_api('/projects?simple=true', user)
|
||||
|
|
Loading…
Reference in a new issue