Commit eddb1dac authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'nfriend-add-self-release-link' into 'master'

Add "self" link to Release API response

See merge request gitlab-org/gitlab!23896
parents 20c9d7f3 222b6c80
......@@ -19,6 +19,12 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
project_tag_path(project, release.tag)
end
def self_url
return unless ::Feature.enabled?(:release_show_page, project)
project_release_url(project, release)
end
def merge_requests_url
return unless release_mr_issue_urls_available?
......
......@@ -1056,6 +1056,7 @@ module API
expose :evidence_file_path, expose_nil: false, if: ->(_, _) { can_download_code? }
end
expose :_links do
expose :self_url, as: :self, expose_nil: false
expose :merge_requests_url, expose_nil: false
expose :issues_url, expose_nil: false
expose :edit_url, expose_nil: false
......
......@@ -51,6 +51,22 @@ describe ReleasePresenter do
end
end
describe '#self_url' do
subject { presenter.self_url }
it 'returns its own url' do
is_expected.to match /#{project_release_url(project, release)}/
end
context 'when release_show_page feature flag is disabled' do
before do
stub_feature_flags(release_show_page: false)
end
it { is_expected.to be_nil }
end
end
describe '#merge_requests_url' do
subject { presenter.merge_requests_url }
......
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