diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-11-07 14:57:16 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-11-07 14:57:16 +0000 |
commit | fadaa3d181b26c420a2424d35780cddc9fc32ce0 (patch) | |
tree | 8f1d3b86319b9c6778d2b1910598763db0624f7b /lib/api/entities.rb | |
parent | ac8f157301fed1ce83969ff4bb9aa6dc99a895e6 (diff) | |
parent | 4d23090877c2af3634a7f02802fb765d969bd38e (diff) | |
download | gitlab-ce-fadaa3d181b26c420a2424d35780cddc9fc32ce0.tar.gz |
Merge branch 'dm-api-merge-requests-index-merged-at' into 'master'
Expose {closed,merged}_{at,by} in merge requests API index
Closes #52031
See merge request gitlab-org/gitlab-ce!22806
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r-- | lib/api/entities.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 9f7be27b047..61d57c643f0 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -607,6 +607,22 @@ module API end class MergeRequestBasic < ProjectEntity + expose :merged_by, using: Entities::UserBasic do |merge_request, _options| + merge_request.metrics&.merged_by + end + + expose :merged_at do |merge_request, _options| + merge_request.metrics&.merged_at + end + + expose :closed_by, using: Entities::UserBasic do |merge_request, _options| + merge_request.metrics&.latest_closed_by + end + + expose :closed_at do |merge_request, _options| + merge_request.metrics&.latest_closed_at + end + expose :title_html, if: -> (_, options) { options[:render_html] } do |entity| MarkupHelper.markdown_field(entity, :title) end @@ -676,22 +692,6 @@ module API merge_request.merge_request_diff.real_size end - expose :merged_by, using: Entities::UserBasic do |merge_request, _options| - merge_request.metrics&.merged_by - end - - expose :merged_at do |merge_request, _options| - merge_request.metrics&.merged_at - end - - expose :closed_by, using: Entities::UserBasic do |merge_request, _options| - merge_request.metrics&.latest_closed_by - end - - expose :closed_at do |merge_request, _options| - merge_request.metrics&.latest_closed_at - end - expose :latest_build_started_at, if: -> (_, options) { build_available?(options) } do |merge_request, _options| merge_request.metrics&.latest_build_started_at end |