diff options
author | Alexandru Croitor <acroitor@gitlab.com> | 2019-04-04 12:01:09 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-04-04 12:01:09 +0300 |
commit | f4adb50ef2ddac2b49050b312fd79e8960ead301 (patch) | |
tree | b1110bebe127f8d913bd332ef6019b8d333f4a49 /lib | |
parent | cdce2074c782c44c12c0421a0d7306a286388315 (diff) |
Expose head pipeline in the related merge requests
Expose head pipeline for the MR in the api when requesting
related merge requests for an issue and show a detailed
status for the pipeline, which would include:
details_path, favicon, group, icon, label, text, tooltip.
https://gitlab.com/gitlab-org/gitlab-ce/issues/57662#note_152023412
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 9 | ||||
-rw-r--r-- | lib/api/issues.rb | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index cc62b5a3661..2dd3120d3fc 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -690,6 +690,10 @@ module API # Deprecated expose :allow_collaboration, as: :allow_maintainer_to_push, if: -> (merge_request, _) { merge_request.for_fork? } + expose :reference do |merge_request, options| + merge_request.to_reference(options[:project]) + end + expose :web_url do |merge_request| Gitlab::UrlBuilder.build(merge_request) end @@ -726,6 +730,8 @@ module API merge_request.metrics&.pipeline end + expose :head_pipeline, using: 'API::Entities::Pipeline' + expose :diff_refs, using: Entities::DiffRefs # Allow the status of a rebase to be determined @@ -1267,6 +1273,9 @@ module API expose :created_at, :updated_at, :started_at, :finished_at, :committed_at expose :duration expose :coverage + expose :detailed_status, using: DetailedStatusEntity do |pipeline, options| + pipeline.detailed_status(options[:current_user]) + end end class PipelineSchedule < Grape::Entity diff --git a/lib/api/issues.rb b/lib/api/issues.rb index fae20e45bf9..3dd90502050 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -310,7 +310,7 @@ module API .flatten present paginate(::Kaminari.paginate_array(merge_requests)), - with: Entities::MergeRequestBasic, + with: Entities::MergeRequest, current_user: current_user, project: user_project end |