Commit cd3d91ee authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '58275-rename-project-entity-ee' into 'master'

Rename ProjectEntity to IssuableEntity

See merge request gitlab-org/gitlab-ee!14484
parents 0d8f6c30 0b35ea6c
...@@ -363,35 +363,8 @@ module EE ...@@ -363,35 +363,8 @@ module EE
expose :user, using: ::API::Entities::UserBasic expose :user, using: ::API::Entities::UserBasic
end end
# @deprecated, replaced with ApprovalState
class MergeRequestApprovals < ::API::Entities::ProjectEntity
def initialize(merge_request, options = {})
presenter = merge_request.present(current_user: options[:current_user])
super(presenter, options)
end
expose :merge_status
expose :approvals_required
expose :approvals_left
expose :approvals, as: :approved_by, using: EE::API::Entities::Approvals
expose :approvers_left, as: :suggested_approvers, using: ::API::Entities::UserBasic
# @deprecated
expose :approvers, using: EE::API::Entities::Approver
# @deprecated
expose :approver_groups, using: EE::API::Entities::ApproverGroup
expose :user_has_approved do |merge_request, options|
merge_request.has_approved?(options[:current_user])
end
expose :user_can_approve do |merge_request, options|
merge_request.can_approve?(options[:current_user])
end
end
class ApprovalState < Grape::Entity class ApprovalState < Grape::Entity
expose :merge_request, merge: true, using: ::API::Entities::ProjectEntity expose :merge_request, merge: true, using: ::API::Entities::IssuableEntity
expose(:merge_status) { |approval_state| approval_state.merge_request.merge_status } expose(:merge_status) { |approval_state| approval_state.merge_request.merge_status }
expose :approved?, as: :approved expose :approved?, as: :approved
......
...@@ -511,7 +511,7 @@ module API ...@@ -511,7 +511,7 @@ module API
end end
end end
class ProjectEntity < Grape::Entity class IssuableEntity < Grape::Entity
expose :id, :iid expose :id, :iid
expose(:project_id) { |entity| entity&.project.try(:id) } expose(:project_id) { |entity| entity&.project.try(:id) }
expose :title, :description expose :title, :description
...@@ -564,7 +564,7 @@ module API ...@@ -564,7 +564,7 @@ module API
end end
end end
class IssueBasic < ProjectEntity class IssueBasic < IssuableEntity
expose :closed_at expose :closed_at
expose :closed_by, using: Entities::UserBasic expose :closed_by, using: Entities::UserBasic
...@@ -670,14 +670,14 @@ module API ...@@ -670,14 +670,14 @@ module API
end end
end end
class MergeRequestSimple < ProjectEntity class MergeRequestSimple < IssuableEntity
expose :title expose :title
expose :web_url do |merge_request, options| expose :web_url do |merge_request, options|
Gitlab::UrlBuilder.build(merge_request) Gitlab::UrlBuilder.build(merge_request)
end end
end end
class MergeRequestBasic < ProjectEntity class MergeRequestBasic < IssuableEntity
expose :merged_by, using: Entities::UserBasic do |merge_request, _options| expose :merged_by, using: Entities::UserBasic do |merge_request, _options|
merge_request.metrics&.merged_by merge_request.metrics&.merged_by
end end
......
...@@ -28,7 +28,7 @@ module API ...@@ -28,7 +28,7 @@ module API
desc 'Import a GitHub project' do desc 'Import a GitHub project' do
detail 'This feature was introduced in GitLab 11.3.4.' detail 'This feature was introduced in GitLab 11.3.4.'
success Entities::ProjectEntity success ::ProjectEntity
end end
params do params do
requires :personal_access_token, type: String, desc: 'GitHub personal access token' requires :personal_access_token, type: String, desc: 'GitHub personal access token'
......
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