Commit a3b8dbfa authored by Katrin Leinweber's avatar Katrin Leinweber Committed by Alex Pooley

Stop using view helpers in AlertPresenter

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/341387
parent f25fd8d0
......@@ -19,14 +19,7 @@ Rails/IncludeUrlHelper:
- app/models/integrations/redmine.rb
- app/models/integrations/webex_teams.rb
- app/models/integrations/youtrack.rb
- app/presenters/alert_management/alert_presenter.rb
- app/presenters/environment_presenter.rb
- app/presenters/gitlab/blame_presenter.rb
- app/presenters/merge_request_presenter.rb
- app/presenters/project_presenter.rb
- app/presenters/release_presenter.rb
- app/presenters/releases/evidence_presenter.rb
- ee/app/helpers/license_helper.rb
- ee/app/models/integrations/github.rb
- ee/spec/helpers/ee/projects/security/configuration_helper_spec.rb
- ee/spec/lib/banzai/filter/cross_project_issuable_information_filter_spec.rb
......
......@@ -3,7 +3,6 @@
module AlertManagement
class AlertPresenter < Gitlab::View::Presenter::Delegated
include IncidentManagement::Settings
include ActionView::Helpers::UrlHelper
presents ::AlertManagement::Alert
delegator_override_with Gitlab::Utils::StrongMemoize # TODO: Remove `Gitlab::Utils::StrongMemoize` inclusion as it's duplicate
......
# frozen_string_literal: true
class EnvironmentPresenter < Gitlab::View::Presenter::Delegated
include ActionView::Helpers::UrlHelper
presents ::Environment, as: :environment
def path
......
# frozen_string_literal: true
class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
include ActionView::Helpers::UrlHelper
include GitlabRoutingHelper
include MarkupHelper
include TreeHelper
......@@ -287,6 +286,11 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
def user_can_fork_project?
can?(current_user, :fork_project, project)
end
# Avoid including ActionView::Helpers::UrlHelper
def link_to(*args)
ApplicationController.helpers.link_to(*args)
end
end
MergeRequestPresenter.prepend_mod_with('MergeRequestPresenter')
......@@ -2,7 +2,6 @@
class ProjectPresenter < Gitlab::View::Presenter::Delegated
include ActionView::Helpers::NumberHelper
include ActionView::Helpers::UrlHelper
include GitlabRoutingHelper
include StorageHelper
include TreeHelper
......@@ -473,6 +472,11 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
project.topics.map(&:name)
end
end
# Avoid including ActionView::Helpers::UrlHelper
def content_tag(*args)
ActionController::Base.helpers.content_tag(*args)
end
end
ProjectPresenter.prepend_mod_with('ProjectPresenter')
# frozen_string_literal: true
class ReleasePresenter < Gitlab::View::Presenter::Delegated
include ActionView::Helpers::UrlHelper
presents ::Release, as: :release
# TODO: Remove `delegate` as it's redundant due to SimpleDelegator.
......
......@@ -2,8 +2,6 @@
module Releases
class EvidencePresenter < Gitlab::View::Presenter::Delegated
include ActionView::Helpers::UrlHelper
presents ::Releases::Evidence, as: :evidence
def filepath
......
......@@ -2,7 +2,6 @@
module LicenseHelper
include ActionView::Helpers::AssetTagHelper
include ActionView::Helpers::UrlHelper
delegate :new_admin_license_path, to: 'Gitlab::Routing.url_helpers'
......
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