Commit b1f3ca44 authored by Hordur Freyr Yngvason's avatar Hordur Freyr Yngvason Committed by Stan Hu

Stop using view helpers in ClusterablePresenter classes

See https://gitlab.com/gitlab-org/gitlab/-/issues/341392
parent fe85df27
...@@ -2591,10 +2591,7 @@ Rails/IncludeUrlHelper: ...@@ -2591,10 +2591,7 @@ Rails/IncludeUrlHelper:
- 'app/presenters/ci/pipeline_presenter.rb' - 'app/presenters/ci/pipeline_presenter.rb'
- 'app/presenters/environment_presenter.rb' - 'app/presenters/environment_presenter.rb'
- 'app/presenters/gitlab/blame_presenter.rb' - 'app/presenters/gitlab/blame_presenter.rb'
- 'app/presenters/group_clusterable_presenter.rb'
- 'app/presenters/instance_clusterable_presenter.rb'
- 'app/presenters/merge_request_presenter.rb' - 'app/presenters/merge_request_presenter.rb'
- 'app/presenters/project_clusterable_presenter.rb'
- 'app/presenters/project_presenter.rb' - 'app/presenters/project_presenter.rb'
- 'app/presenters/prometheus_alert_presenter.rb' - 'app/presenters/prometheus_alert_presenter.rb'
- 'app/presenters/release_presenter.rb' - 'app/presenters/release_presenter.rb'
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
class GroupClusterablePresenter < ClusterablePresenter class GroupClusterablePresenter < ClusterablePresenter
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
include ActionView::Helpers::UrlHelper
presents ::Group presents ::Group
...@@ -33,7 +32,7 @@ class GroupClusterablePresenter < ClusterablePresenter ...@@ -33,7 +32,7 @@ class GroupClusterablePresenter < ClusterablePresenter
override :learn_more_link override :learn_more_link
def learn_more_link def learn_more_link
link_to(s_('ClusterIntegration|Learn more about group Kubernetes clusters'), help_page_path('user/group/clusters/index'), target: '_blank', rel: 'noopener noreferrer') ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about group Kubernetes clusters'), help_page_path('user/group/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end end
def metrics_dashboard_path(cluster) def metrics_dashboard_path(cluster)
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
class InstanceClusterablePresenter < ClusterablePresenter class InstanceClusterablePresenter < ClusterablePresenter
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
include ActionView::Helpers::UrlHelper
presents ::Clusters::Instance presents ::Clusters::Instance
...@@ -71,7 +70,7 @@ class InstanceClusterablePresenter < ClusterablePresenter ...@@ -71,7 +70,7 @@ class InstanceClusterablePresenter < ClusterablePresenter
override :learn_more_link override :learn_more_link
def learn_more_link def learn_more_link
link_to(s_('ClusterIntegration|Learn more about instance Kubernetes clusters'), help_page_path('user/instance/clusters/index'), target: '_blank', rel: 'noopener noreferrer') ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about instance Kubernetes clusters'), help_page_path('user/instance/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end end
def metrics_dashboard_path(cluster) def metrics_dashboard_path(cluster)
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
class ProjectClusterablePresenter < ClusterablePresenter class ProjectClusterablePresenter < ClusterablePresenter
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
include ActionView::Helpers::UrlHelper
presents ::Project presents ::Project
...@@ -28,7 +27,7 @@ class ProjectClusterablePresenter < ClusterablePresenter ...@@ -28,7 +27,7 @@ class ProjectClusterablePresenter < ClusterablePresenter
override :learn_more_link override :learn_more_link
def learn_more_link def learn_more_link
link_to(s_('ClusterIntegration|Learn more about Kubernetes'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer') ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about Kubernetes'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end end
def metrics_dashboard_path(cluster) def metrics_dashboard_path(cluster)
......
...@@ -84,4 +84,10 @@ RSpec.describe GroupClusterablePresenter do ...@@ -84,4 +84,10 @@ RSpec.describe GroupClusterablePresenter do
it { is_expected.to eq(metrics_dashboard_group_cluster_path(group, cluster)) } it { is_expected.to eq(metrics_dashboard_group_cluster_path(group, cluster)) }
end end
describe '#learn_more_link' do
subject { presenter.learn_more_link }
it { is_expected.to include('user/group/clusters/index') }
end
end end
...@@ -32,4 +32,10 @@ RSpec.describe InstanceClusterablePresenter do ...@@ -32,4 +32,10 @@ RSpec.describe InstanceClusterablePresenter do
it { is_expected.to eq(metrics_dashboard_admin_cluster_path(cluster)) } it { is_expected.to eq(metrics_dashboard_admin_cluster_path(cluster)) }
end end
describe '#learn_more_link' do
subject { presenter.learn_more_link }
it { is_expected.to include('user/instance/clusters/index') }
end
end end
...@@ -84,4 +84,10 @@ RSpec.describe ProjectClusterablePresenter do ...@@ -84,4 +84,10 @@ RSpec.describe ProjectClusterablePresenter do
it { is_expected.to eq(metrics_dashboard_project_cluster_path(project, cluster)) } it { is_expected.to eq(metrics_dashboard_project_cluster_path(project, cluster)) }
end end
describe '#learn_more_link' do
subject { presenter.learn_more_link }
it { is_expected.to include('user/project/clusters/index') }
end
end 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