diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2016-10-27 09:26:58 -0400 |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2017-02-14 13:22:14 -0500 |
commit | 309aee45b69888f9b51aaa0ce393a3f13b08c255 (patch) | |
tree | 3ddeb4d01c44afbe2363de6ee649ef4fa664b3b2 /lib | |
parent | e5f446b7ca4bc54ffaf527e4c57dea2bee2f79f6 (diff) | |
download | gitlab-ce-309aee45b69888f9b51aaa0ce393a3f13b08c255.tar.gz |
entities: use the RepoCommit entity for branch commits
Fixes #23895.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 2a071e649fa..0b8204fe7f3 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -155,10 +155,27 @@ module API expose :shared_projects, using: Entities::Project end + class RepoCommit < Grape::Entity + expose :id, :short_id, :title, :created_at + expose :parent_ids + expose :safe_message, as: :message + expose :author_name, :author_email, :authored_date + expose :committer_name, :committer_email, :committed_date + end + + class RepoCommitStats < Grape::Entity + expose :additions, :deletions, :total + end + + class RepoCommitDetail < RepoCommit + expose :stats, using: Entities::RepoCommitStats + expose :status + end + class RepoBranch < Grape::Entity expose :name - expose :commit do |repo_branch, options| + expose :commit, using: Entities::RepoCommit do |repo_branch, options| options[:project].repository.commit(repo_branch.dereferenced_target) end @@ -193,22 +210,6 @@ module API end end - class RepoCommit < Grape::Entity - expose :id, :short_id, :title, :author_name, :author_email, :created_at - expose :committer_name, :committer_email - expose :safe_message, as: :message - end - - class RepoCommitStats < Grape::Entity - expose :additions, :deletions, :total - end - - class RepoCommitDetail < RepoCommit - expose :parent_ids, :committed_date, :authored_date - expose :stats, using: Entities::RepoCommitStats - expose :status - end - class ProjectSnippet < Grape::Entity expose :id, :title, :file_name expose :author, using: Entities::UserBasic |