Commit a0193694 authored by Douwe Maan's avatar Douwe Maan

Expose avatar_url when requesting list of projects from API with simple=true

parent 923ad9a9
---
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 ...@@ -89,6 +89,9 @@ module API
expose :ssh_url_to_repo, :http_url_to_repo, :web_url expose :ssh_url_to_repo, :http_url_to_repo, :web_url
expose :name, :name_with_namespace expose :name, :name_with_namespace
expose :path, :path_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 :star_count, :forks_count
expose :created_at, :last_activity_at expose :created_at, :last_activity_at
end end
...@@ -146,9 +149,7 @@ module API ...@@ -146,9 +149,7 @@ module API
expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? } expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? }
expose :import_status expose :import_status
expose :import_error, if: lambda { |_project, options| options[:user_can_admin_project] } 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 :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 :runners_token, if: lambda { |_project, options| options[:user_can_admin_project] }
expose :public_builds, as: :public_jobs expose :public_builds, as: :public_jobs
...@@ -193,8 +194,8 @@ module API ...@@ -193,8 +194,8 @@ module API
class Group < Grape::Entity class Group < Grape::Entity
expose :id, :name, :path, :description, :visibility expose :id, :name, :path, :description, :visibility
expose :lfs_enabled?, as: :lfs_enabled expose :lfs_enabled?, as: :lfs_enabled
expose :avatar_url do |user, options| expose :avatar_url do |group, options|
user.avatar_url(only_path: false) group.avatar_url(only_path: false)
end end
expose :web_url expose :web_url
expose :request_access_enabled expose :request_access_enabled
......
...@@ -20,6 +20,7 @@ describe API::Environments do ...@@ -20,6 +20,7 @@ describe API::Environments do
path path_with_namespace path path_with_namespace
star_count forks_count star_count forks_count
created_at last_activity_at created_at last_activity_at
avatar_url
) )
get api("/projects/#{project.id}/environments", user) get api("/projects/#{project.id}/environments", user)
......
...@@ -193,6 +193,7 @@ describe API::Projects do ...@@ -193,6 +193,7 @@ describe API::Projects do
path path_with_namespace path path_with_namespace
star_count forks_count star_count forks_count
created_at last_activity_at created_at last_activity_at
avatar_url
) )
get api('/projects?simple=true', user) get api('/projects?simple=true', user)
......
...@@ -89,6 +89,7 @@ describe API::V3::Projects do ...@@ -89,6 +89,7 @@ describe API::V3::Projects do
path path_with_namespace path path_with_namespace
star_count forks_count star_count forks_count
created_at last_activity_at created_at last_activity_at
avatar_url
) )
get v3_api('/projects?simple=true', user) get v3_api('/projects?simple=true', user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment