diff options
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 6 | ||||
-rw-r--r-- | app/presenters/ci/runner_presenter.rb | 12 | ||||
-rw-r--r-- | app/presenters/clusterable_presenter.rb | 8 | ||||
-rw-r--r-- | app/presenters/gitlab/blame_presenter.rb | 7 | ||||
-rw-r--r-- | app/presenters/group_clusterable_presenter.rb | 10 | ||||
-rw-r--r-- | app/presenters/instance_clusterable_presenter.rb | 10 | ||||
-rw-r--r-- | app/presenters/merge_request_presenter.rb | 17 | ||||
-rw-r--r-- | app/presenters/project_clusterable_presenter.rb | 10 | ||||
-rw-r--r-- | app/presenters/project_presenter.rb | 14 |
9 files changed, 37 insertions, 57 deletions
diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 52f4a4e71a1..0baee614568 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -58,11 +58,7 @@ module Ci # rubocop: disable CodeReuse/ActiveRecord def all_dependencies dependencies = super - - if Feature.enabled?(:preload_associations_jobs_request_api_endpoint, project, default_enabled: :yaml) - ActiveRecord::Associations::Preloader.new.preload(dependencies, :job_artifacts_archive) - end - + ActiveRecord::Associations::Preloader.new.preload(dependencies, :job_artifacts_archive) dependencies end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/presenters/ci/runner_presenter.rb b/app/presenters/ci/runner_presenter.rb new file mode 100644 index 00000000000..273328afc53 --- /dev/null +++ b/app/presenters/ci/runner_presenter.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Ci + class RunnerPresenter < Gitlab::View::Presenter::Delegated + presents :runner + + def locked? + read_attribute(:locked) && project_type? + end + alias_method :locked, :locked? + end +end diff --git a/app/presenters/clusterable_presenter.rb b/app/presenters/clusterable_presenter.rb index a316793dae9..03e26b92922 100644 --- a/app/presenters/clusterable_presenter.rb +++ b/app/presenters/clusterable_presenter.rb @@ -48,14 +48,6 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated raise NotImplementedError end - def install_applications_cluster_path(cluster, application) - raise NotImplementedError - end - - def update_applications_cluster_path(cluster, application) - raise NotImplementedError - end - def clear_cluster_cache_path(cluster) raise NotImplementedError end diff --git a/app/presenters/gitlab/blame_presenter.rb b/app/presenters/gitlab/blame_presenter.rb index 26c78384144..1f2445b04a1 100644 --- a/app/presenters/gitlab/blame_presenter.rb +++ b/app/presenters/gitlab/blame_presenter.rb @@ -66,17 +66,14 @@ module Gitlab link_to project_blame_path(project, tree_join(previous_commit_id, path)), title: _('View blame prior to this change'), aria: { label: _('View blame prior to this change') }, + class: 'version-link', data: { toggle: 'tooltip', placement: 'right', container: 'body' } do - versions_sprite_icon + ' '.html_safe end end def project_duration @project_duration ||= age_map_duration(groups, project) end - - def versions_sprite_icon - @versions_sprite_icon ||= sprite_icon('doc-versions', css_class: 'doc-versions align-text-bottom') - end end end diff --git a/app/presenters/group_clusterable_presenter.rb b/app/presenters/group_clusterable_presenter.rb index adbe20517be..34e7084ab02 100644 --- a/app/presenters/group_clusterable_presenter.rb +++ b/app/presenters/group_clusterable_presenter.rb @@ -9,16 +9,6 @@ class GroupClusterablePresenter < ClusterablePresenter cluster_status_group_cluster_path(clusterable, cluster, params) end - override :install_applications_cluster_path - def install_applications_cluster_path(cluster, application) - install_applications_group_cluster_path(clusterable, cluster, application) - end - - override :update_applications_cluster_path - def update_applications_cluster_path(cluster, application) - update_applications_group_cluster_path(clusterable, cluster, application) - end - override :clear_cluster_cache_path def clear_cluster_cache_path(cluster) clear_cache_group_cluster_path(clusterable, cluster) diff --git a/app/presenters/instance_clusterable_presenter.rb b/app/presenters/instance_clusterable_presenter.rb index 84b3328b37f..56d91f90b2e 100644 --- a/app/presenters/instance_clusterable_presenter.rb +++ b/app/presenters/instance_clusterable_presenter.rb @@ -27,16 +27,6 @@ class InstanceClusterablePresenter < ClusterablePresenter cluster_status_admin_cluster_path(cluster, params) end - override :install_applications_cluster_path - def install_applications_cluster_path(cluster, application) - install_applications_admin_cluster_path(cluster, application) - end - - override :update_applications_cluster_path - def update_applications_cluster_path(cluster, application) - update_applications_admin_cluster_path(cluster, application) - end - override :clear_cluster_cache_path def clear_cluster_cache_path(cluster) clear_cache_admin_cluster_path(cluster) diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb index 6bf5e0bd1b0..fc8a290f5f7 100644 --- a/app/presenters/merge_request_presenter.rb +++ b/app/presenters/merge_request_presenter.rb @@ -139,7 +139,6 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated end def mentioned_issues_links - mentioned_issues = issues_mentioned_but_not_closing(current_user) markdown( issues_sentence(project, mentioned_issues), pipeline: :gfm, @@ -239,6 +238,18 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated APPROVALS_WIDGET_BASE_TYPE end + def closing_issues + strong_memoize(:closing_issues) do + visible_closing_issues_for(current_user) + end + end + + def mentioned_issues + strong_memoize(:mentioned_issues) do + issues_mentioned_but_not_closing(current_user) + end + end + private def cached_can_be_reverted? @@ -253,10 +264,6 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated # rubocop: enable CodeReuse/ServiceClass end - def closing_issues - @closing_issues ||= visible_closing_issues_for(current_user) - end - def pipeline @pipeline ||= actual_head_pipeline end diff --git a/app/presenters/project_clusterable_presenter.rb b/app/presenters/project_clusterable_presenter.rb index 1c5f11ffe59..920304e743e 100644 --- a/app/presenters/project_clusterable_presenter.rb +++ b/app/presenters/project_clusterable_presenter.rb @@ -9,16 +9,6 @@ class ProjectClusterablePresenter < ClusterablePresenter cluster_status_project_cluster_path(clusterable, cluster, params) end - override :install_applications_cluster_path - def install_applications_cluster_path(cluster, application) - install_applications_project_cluster_path(clusterable, cluster, application) - end - - override :update_applications_cluster_path - def update_applications_cluster_path(cluster, application) - update_applications_project_cluster_path(clusterable, cluster, application) - end - override :clear_cluster_cache_path def clear_cluster_cache_path(cluster) clear_cache_project_cluster_path(clusterable, cluster) diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index 0d038d19af3..80a8ee5cb3c 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -397,16 +397,16 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated end def topics_to_show - project.topic_list.take(MAX_TOPICS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord + project_topic_list.take(MAX_TOPICS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord end def topics_not_shown - project.topic_list - topics_to_show + project_topic_list - topics_to_show end def count_of_extra_topics_not_shown - if project.topic_list.count > MAX_TOPICS_TO_SHOW - project.topic_list.count - MAX_TOPICS_TO_SHOW + if project_topic_list.count > MAX_TOPICS_TO_SHOW + project_topic_list.count - MAX_TOPICS_TO_SHOW else 0 end @@ -486,6 +486,12 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated **additional_params ) end + + def project_topic_list + strong_memoize(:project_topic_list) do + project.topics.map(&:name) + end + end end ProjectPresenter.prepend_mod_with('ProjectPresenter') |