diff options
-rw-r--r-- | app/helpers/gitlab_routing_helper.rb | 10 | ||||
-rw-r--r-- | app/models/project_services/gitlab_issue_tracker_service.rb | 2 | ||||
-rw-r--r-- | app/models/project_services/jira_service.rb | 2 | ||||
-rw-r--r-- | app/serializers/request_aware_entity.rb | 2 | ||||
-rw-r--r-- | app/services/chat_names/authorize_user_service.rb | 2 | ||||
-rw-r--r-- | config/application.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/badge/metadata.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/status/core.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/conflict/file.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/email/message/repository_push.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/routing.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/slash_commands/presenters/base.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/url_builder.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/view/presenter/base.rb | 2 |
14 files changed, 25 insertions, 15 deletions
diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb index b5f4bbe97dc..d03b0264a78 100644 --- a/app/helpers/gitlab_routing_helper.rb +++ b/app/helpers/gitlab_routing_helper.rb @@ -2,6 +2,16 @@ module GitlabRoutingHelper extend ActiveSupport::Concern + def self.require_gitlab_routing(mod = nil) + @require_gitlab_routing ||= [] + + if mod + @require_gitlab_routing << mod + else + @require_gitlab_routing + end + end + # Project def project_tree_path(project, ref = nil, *args) namespace_project_tree_path(project.namespace, project, ref || @ref || project.repository.root_ref, *args) # rubocop:disable Cop/ProjectPathHelper diff --git a/app/models/project_services/gitlab_issue_tracker_service.rb b/app/models/project_services/gitlab_issue_tracker_service.rb index 5e31f393bbe..2e1f2ab6d32 100644 --- a/app/models/project_services/gitlab_issue_tracker_service.rb +++ b/app/models/project_services/gitlab_issue_tracker_service.rb @@ -1,5 +1,5 @@ class GitlabIssueTrackerService < IssueTrackerService - include Gitlab::Routing.url_helpers + GitlabRoutingHelper.require_gitlab_routing(self) validates :project_url, :issues_url, :new_issue_url, presence: true, url: true, if: :activated? diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb index 8af642b44aa..66c78161ff4 100644 --- a/app/models/project_services/jira_service.rb +++ b/app/models/project_services/jira_service.rb @@ -1,5 +1,5 @@ class JiraService < IssueTrackerService - include Gitlab::Routing.url_helpers + GitlabRoutingHelper.require_gitlab_routing(self) validates :url, url: true, presence: true, if: :activated? validates :api_url, url: true, allow_blank: true diff --git a/app/serializers/request_aware_entity.rb b/app/serializers/request_aware_entity.rb index d53fcfb8c1b..e6b24669040 100644 --- a/app/serializers/request_aware_entity.rb +++ b/app/serializers/request_aware_entity.rb @@ -2,7 +2,7 @@ module RequestAwareEntity extend ActiveSupport::Concern included do - include Gitlab::Routing + GitlabRoutingHelper.require_gitlab_routing(self) include GitlabRoutingHelper include Gitlab::Allowable end diff --git a/app/services/chat_names/authorize_user_service.rb b/app/services/chat_names/authorize_user_service.rb index 321bf3a9205..408f90cde23 100644 --- a/app/services/chat_names/authorize_user_service.rb +++ b/app/services/chat_names/authorize_user_service.rb @@ -1,6 +1,6 @@ module ChatNames class AuthorizeUserService - include Gitlab::Routing.url_helpers + GitlabRoutingHelper.require_gitlab_routing(self) def initialize(service, params) @service = service diff --git a/config/application.rb b/config/application.rb index 3e6d72810cd..cca9f64134e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -185,6 +185,10 @@ module Gitlab GitlabRoutingHelper.include project_url_helpers GitlabRoutingHelper.extend project_url_helpers + + GitlabRoutingHelper.require_gitlab_routing.each do |mod| + mod.include Gitlab::Routing.url_helpers + end end end end diff --git a/lib/gitlab/badge/metadata.rb b/lib/gitlab/badge/metadata.rb index 86c193650fb..e745b9557d2 100644 --- a/lib/gitlab/badge/metadata.rb +++ b/lib/gitlab/badge/metadata.rb @@ -4,7 +4,7 @@ module Gitlab # Abstract class for badge metadata # class Metadata - include Gitlab::Routing.url_helpers + GitlabRoutingHelper.require_gitlab_routing(self) include ActionView::Helpers::AssetTagHelper include ActionView::Helpers::UrlHelper diff --git a/lib/gitlab/ci/status/core.rb b/lib/gitlab/ci/status/core.rb index d4fd83b93f8..73aac413f1e 100644 --- a/lib/gitlab/ci/status/core.rb +++ b/lib/gitlab/ci/status/core.rb @@ -4,7 +4,7 @@ module Gitlab # Base abstract class fore core status # class Core - include Gitlab::Routing + GitlabRoutingHelper.require_gitlab_routing(self) include Gitlab::Allowable attr_reader :subject, :user diff --git a/lib/gitlab/conflict/file.rb b/lib/gitlab/conflict/file.rb index d2b4e6e209e..71bff953c86 100644 --- a/lib/gitlab/conflict/file.rb +++ b/lib/gitlab/conflict/file.rb @@ -1,7 +1,7 @@ module Gitlab module Conflict class File - include Gitlab::Routing.url_helpers + GitlabRoutingHelper.require_gitlab_routing(self) include IconsHelper MissingResolution = Class.new(ResolutionError) diff --git a/lib/gitlab/email/message/repository_push.rb b/lib/gitlab/email/message/repository_push.rb index 42fc2a4ea19..34cf83a6a68 100644 --- a/lib/gitlab/email/message/repository_push.rb +++ b/lib/gitlab/email/message/repository_push.rb @@ -4,7 +4,7 @@ module Gitlab class RepositoryPush attr_reader :author_id, :ref, :action - include Gitlab::Routing.url_helpers + GitlabRoutingHelper.require_gitlab_routing(self) include DiffHelper delegate :namespace, :name_with_namespace, to: :project, prefix: :project diff --git a/lib/gitlab/routing.rb b/lib/gitlab/routing.rb index 632e2d87500..7c084e11ef0 100644 --- a/lib/gitlab/routing.rb +++ b/lib/gitlab/routing.rb @@ -2,10 +2,6 @@ module Gitlab module Routing extend ActiveSupport::Concern - included do - include Gitlab::Routing.url_helpers - end - # Returns the URL helpers Module. # # This method caches the output as Rails' "url_helpers" method creates an diff --git a/lib/gitlab/slash_commands/presenters/base.rb b/lib/gitlab/slash_commands/presenters/base.rb index 27696436574..a25bf9a0741 100644 --- a/lib/gitlab/slash_commands/presenters/base.rb +++ b/lib/gitlab/slash_commands/presenters/base.rb @@ -2,7 +2,7 @@ module Gitlab module SlashCommands module Presenters class Base - include Gitlab::Routing.url_helpers + GitlabRoutingHelper.require_gitlab_routing(self) def initialize(resource = nil) @resource = resource diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb index 073af685a09..530f014c49a 100644 --- a/lib/gitlab/url_builder.rb +++ b/lib/gitlab/url_builder.rb @@ -1,6 +1,6 @@ module Gitlab class UrlBuilder - include Gitlab::Routing.url_helpers + GitlabRoutingHelper.require_gitlab_routing(self) include GitlabRoutingHelper include ActionView::RecordIdentifier diff --git a/lib/gitlab/view/presenter/base.rb b/lib/gitlab/view/presenter/base.rb index 841fb681435..ebae225c167 100644 --- a/lib/gitlab/view/presenter/base.rb +++ b/lib/gitlab/view/presenter/base.rb @@ -6,7 +6,7 @@ module Gitlab module Base extend ActiveSupport::Concern - include Gitlab::Routing + GitlabRoutingHelper.require_gitlab_routing(self) include Gitlab::Allowable attr_reader :subject |