diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-08-08 16:15:16 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-08-08 16:15:16 +0100 |
commit | 23334ac0a151a60ada07b643f703dd0a75223094 (patch) | |
tree | c4e5271de7a5d4842b83179eb7899f9da479b39e /lib/api/entities.rb | |
parent | 15441f0ef564e87f2ffb672452b0fb9d7bd1d44e (diff) | |
parent | 6a6a1e5b9e0a82735f786ffedeacc7cbc33ed7cd (diff) | |
download | gitlab-ce-23334ac0a151a60ada07b643f703dd0a75223094.tar.gz |
Merge branch 'master' into issue-discussions-refactor
* master: (481 commits)
Make sure that we have author and committer
disable file upload button while uploading
Fix bar chart does not display label at hour 0
Fixed activity not loading on project homepage
Expose noteable_iid in Note
Fix fly-out width when it has long items
Add a test to show that threshold 40 would corrupt
Add changelog entry
Raise encoding confidence threshold to 50
Fix the /projects/:id/repository/commits endpoint to handle dots in the ref name when the project full path contains a `/`
Fix the /projects/:id/repository/tags endpoint to handle dots in the tag name when the project full path contains a `/`
Add Italian translations of Pipeline Schedules
Restrict InlineJavaScript for haml_lint to dev and test environment
Incorporate Gitaly's CommitService.FindCommit RPC
Move `deltas` and `diff_from_parents` logic to Gitlab::Git::Commit
fix repo_edit_button_spec.js
fix test failures in repo_preview_spec.js
fix repo_loading_file_spec tests
Refactor Gitlab::Git::Commit to include a repository
use 100vh instead of flip flopping between the two - works on all suported browsers
...
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r-- | lib/api/entities.rb | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 29733481e2f..225879d94ac 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -66,13 +66,6 @@ module API expose :job_events end - class BasicProjectDetails < Grape::Entity - expose :id - expose :http_url_to_repo, :web_url - expose :name, :name_with_namespace - expose :path, :path_with_namespace - end - class SharedGroup < Grape::Entity expose :group_id expose :group_name do |group_link, options| @@ -81,7 +74,16 @@ module API expose :group_access, as: :group_access_level end - class Project < Grape::Entity + class BasicProjectDetails < Grape::Entity + expose :id, :description, :default_branch, :tag_list + expose :ssh_url_to_repo, :http_url_to_repo, :web_url + expose :name, :name_with_namespace + expose :path, :path_with_namespace + expose :star_count, :forks_count + expose :created_at, :last_activity_at + end + + class Project < BasicProjectDetails include ::API::Helpers::RelatedResourcesHelpers expose :_links do @@ -114,12 +116,9 @@ module API end end - expose :id, :description, :default_branch, :tag_list expose :archived?, as: :archived - expose :visibility, :ssh_url_to_repo, :http_url_to_repo, :web_url + expose :visibility expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group } - expose :name, :name_with_namespace - expose :path, :path_with_namespace expose :container_registry_enabled # Expose old field names with the new permissions methods to keep API compatible @@ -129,7 +128,6 @@ module API expose(:jobs_enabled) { |project, options| project.feature_available?(:builds, options[:current_user]) } expose(:snippets_enabled) { |project, options| project.feature_available?(:snippets, options[:current_user]) } - expose :created_at, :last_activity_at expose :shared_runners_enabled expose :lfs_enabled?, as: :lfs_enabled expose :creator_id @@ -140,7 +138,6 @@ module API expose :avatar_url do |user, options| user.avatar_url(only_path: false) end - expose :star_count, :forks_count 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 @@ -457,6 +454,9 @@ module API end class Note < Grape::Entity + # Only Issue and MergeRequest have iid + NOTEABLE_TYPES_WITH_IID = %w(Issue MergeRequest).freeze + expose :id expose :note, as: :body expose :attachment_identifier, as: :attachment @@ -464,6 +464,9 @@ module API expose :created_at, :updated_at expose :system?, as: :system expose :noteable_id, :noteable_type + + # Avoid N+1 queries as much as possible + expose(:noteable_iid) { |note| note.noteable.iid if NOTEABLE_TYPES_WITH_IID.include?(note.noteable_type) } end class AwardEmoji < Grape::Entity @@ -702,7 +705,7 @@ module API class RepoTag < Grape::Entity expose :name, :message - expose :commit do |repo_tag, options| + expose :commit, using: Entities::RepoCommit do |repo_tag, options| options[:project].repository.commit(repo_tag.dereferenced_target) end @@ -954,5 +957,11 @@ module API expose :ip_address expose :submitted, as: :akismet_submitted end + + class RepositoryStorageHealth < Grape::Entity + expose :storage_name + expose :failing_on_hosts + expose :total_failures + end end end |