diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /app/presenters/release_presenter.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'app/presenters/release_presenter.rb')
-rw-r--r-- | app/presenters/release_presenter.rb | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/app/presenters/release_presenter.rb b/app/presenters/release_presenter.rb index c27059c6d63..b11585d0d1c 100644 --- a/app/presenters/release_presenter.rb +++ b/app/presenters/release_presenter.rb @@ -23,18 +23,36 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated project_release_url(project, release) end - def merge_requests_url + def opened_merge_requests_url return unless release_mr_issue_urls_available? project_merge_requests_url(project, params_for_issues_and_mrs) end - def issues_url + def merged_merge_requests_url + return unless release_mr_issue_urls_available? + + project_merge_requests_url(project, params_for_issues_and_mrs(state: 'merged')) + end + + def closed_merge_requests_url + return unless release_mr_issue_urls_available? + + project_merge_requests_url(project, params_for_issues_and_mrs(state: 'closed')) + end + + def opened_issues_url return unless release_mr_issue_urls_available? project_issues_url(project, params_for_issues_and_mrs) end + def closed_issues_url + return unless release_mr_issue_urls_available? + + project_issues_url(project, params_for_issues_and_mrs(state: 'closed')) + end + def edit_url return unless release_edit_page_available? @@ -53,18 +71,24 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated can_download_code? ? release.name : "Release-#{release.id}" end + def download_url(filepath) + filepath = filepath.sub(%r{^/}, '') if filepath.start_with?('/') + + downloads_project_release_url(project, release, filepath) + end + private def can_download_code? can?(current_user, :download_code, project) end - def params_for_issues_and_mrs - { scope: 'all', state: 'opened', release_tag: release.tag } + def params_for_issues_and_mrs(state: 'opened') + { scope: 'all', state: state, release_tag: release.tag } end def release_mr_issue_urls_available? - ::Feature.enabled?(:release_mr_issue_urls, project) + ::Feature.enabled?(:release_mr_issue_urls, project, default_enabled: true) end def release_edit_page_available? |