summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-07-07 22:23:45 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-07-07 22:27:56 +0800
commitbcc05f03a26f5cd07bee427014276763912782b3 (patch)
tree4c6faa18b07af925f05e676d80dee0d8149181a3 /app
parentd40445e4c9964ae0ab793bfdd7ba530de4259716 (diff)
downloadgitlab-ce-require_gitlab_routing.tar.gz
Make sure we include after all helpers are includedrequire_gitlab_routing
Diffstat (limited to 'app')
-rw-r--r--app/helpers/gitlab_routing_helper.rb10
-rw-r--r--app/models/project_services/gitlab_issue_tracker_service.rb2
-rw-r--r--app/models/project_services/jira_service.rb2
-rw-r--r--app/serializers/request_aware_entity.rb2
-rw-r--r--app/services/chat_names/authorize_user_service.rb2
5 files changed, 14 insertions, 4 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