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 | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/environment_presenter.rb | 4 | ||||
-rw-r--r-- | app/presenters/invitation_presenter.rb | 5 | ||||
-rw-r--r-- | app/presenters/issue_presenter.rb | 4 | ||||
-rw-r--r-- | app/presenters/packages/detail/package_presenter.rb | 13 | ||||
-rw-r--r-- | app/presenters/project_presenter.rb | 6 | ||||
-rw-r--r-- | app/presenters/release_presenter.rb | 34 |
6 files changed, 54 insertions, 12 deletions
diff --git a/app/presenters/environment_presenter.rb b/app/presenters/environment_presenter.rb index 3fa31eb69a2..6f67bbe2a5a 100644 --- a/app/presenters/environment_presenter.rb +++ b/app/presenters/environment_presenter.rb @@ -6,8 +6,6 @@ class EnvironmentPresenter < Gitlab::View::Presenter::Delegated presents :environment def path - if Feature.enabled?(:expose_environment_path_in_alert_details, project) - project_environment_path(project, self) - end + project_environment_path(project, self) end end diff --git a/app/presenters/invitation_presenter.rb b/app/presenters/invitation_presenter.rb new file mode 100644 index 00000000000..d8c07f327dd --- /dev/null +++ b/app/presenters/invitation_presenter.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class InvitationPresenter < Gitlab::View::Presenter::Delegated + presents :invitation +end diff --git a/app/presenters/issue_presenter.rb b/app/presenters/issue_presenter.rb index 0b498ce97d8..76bf3bf4577 100644 --- a/app/presenters/issue_presenter.rb +++ b/app/presenters/issue_presenter.rb @@ -10,6 +10,10 @@ class IssuePresenter < Gitlab::View::Presenter::Delegated def subscribed? issue.subscribed?(current_user, issue.project) end + + def project_emails_disabled? + issue.project.emails_disabled? + end end IssuePresenter.prepend_if_ee('EE::IssuePresenter') diff --git a/app/presenters/packages/detail/package_presenter.rb b/app/presenters/packages/detail/package_presenter.rb index e8223d6498b..dbfcfcb67f3 100644 --- a/app/presenters/packages/detail/package_presenter.rb +++ b/app/presenters/packages/detail/package_presenter.rb @@ -29,7 +29,8 @@ module Packages package_detail[:composer_metadatum] = @package.composer_metadatum if @package.composer_metadatum package_detail[:conan_metadatum] = @package.conan_metadatum if @package.conan_metadatum package_detail[:dependency_links] = @package.dependency_links.map(&method(:build_dependency_links)) - package_detail[:pipeline] = build_pipeline_info(@package.build_info.pipeline) if @package.build_info + package_detail[:pipeline] = build_pipeline_info(@package.pipeline) if @package.pipeline + package_detail[:pipelines] = build_pipeline_infos(@package.pipelines) if @package.pipelines.present? package_detail end @@ -37,12 +38,20 @@ module Packages private def build_package_file_view(package_file) - { + file_view = { created_at: package_file.created_at, download_path: package_file.download_path, file_name: package_file.file_name, size: package_file.size } + + file_view[:pipelines] = build_pipeline_infos(package_file.pipelines) if package_file.pipelines.present? + + file_view + end + + def build_pipeline_infos(pipeline_infos) + pipeline_infos.map { |pipeline_info| build_pipeline_info(pipeline_info) } end def build_pipeline_info(pipeline_info) diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index 392eeafb2b4..0f5b601f2b0 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -13,7 +13,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated presents :project - AnchorData = Struct.new(:is_link, :label, :link, :class_modifier, :icon) + AnchorData = Struct.new(:is_link, :label, :link, :class_modifier, :icon, :itemprop) MAX_TOPICS_TO_SHOW = 3 def statistic_icon(icon_name = 'plus-square-o') @@ -277,7 +277,9 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated AnchorData.new(false, icon + content_tag(:span, license_short_name, class: 'project-stat-value'), license_path, - 'default') + 'default', + nil, + 'license') else if current_user && can_current_user_push_to_default_branch? AnchorData.new(false, 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? |