Commit c461b531 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '216279-add-source-and-destination-branch-data-to-compliance-entity' into 'master'

Add source and destination branch data to compliance entity

See merge request gitlab-org/gitlab!37630
parents fee07c3b ad1f1472
......@@ -24,9 +24,13 @@ class MergeRequestComplianceEntity < Grape::Entity
expose :approved_by_users, using: API::Entities::UserBasic
expose :pipeline_status, if: -> (*) { can_read_pipeline? }, with: DetailedStatusEntity
expose :approval_status
expose :target_branch
expose :target_branch_uri, if: -> (merge_request) { merge_request.target_branch_exists? }
expose :source_branch
expose :source_branch_uri, if: -> (merge_request) { merge_request.source_branch_exists? }
private
alias_method :merge_request, :object
......@@ -53,4 +57,12 @@ class MergeRequestComplianceEntity < Grape::Entity
SUCCESS_APPROVAL_STATUS
end
def target_branch_uri
project_ref_path(merge_request.project, merge_request.target_branch)
end
def source_branch_uri
project_ref_path(merge_request.project, merge_request.source_branch)
end
end
---
title: Add source and destination branch data to compliance entity
merge_request: 37630
author:
type: added
......@@ -17,7 +17,19 @@ RSpec.describe MergeRequestComplianceEntity do
it 'includes merge request attributes for compliance' do
expect(subject).to include(
:id, :title, :merged_at, :milestone, :path, :issuable_reference, :author, :approved_by_users, :approval_status
:id,
:title,
:merged_at,
:milestone,
:path,
:issuable_reference,
:author,
:approved_by_users,
:approval_status,
:target_branch,
:target_branch_uri,
:source_branch,
:source_branch_uri
)
end
......
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