Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/routable.rb')
-rw-r--r--app/models/concerns/routable.rb26
1 files changed, 16 insertions, 10 deletions
diff --git a/app/models/concerns/routable.rb b/app/models/concerns/routable.rb
index d70aad4e9ae..f2badfe48dd 100644
--- a/app/models/concerns/routable.rb
+++ b/app/models/concerns/routable.rb
@@ -25,17 +25,19 @@ module Routable
#
# We need to qualify the columns with the table name, to support both direct lookups on
# Route/RedirectRoute, and scoped lookups through the Routable classes.
- route =
- route_scope.find_by(routes: { path: path }) ||
- route_scope.iwhere(Route.arel_table[:path] => path).take
+ Gitlab::Database.allow_cross_joins_across_databases(url: "https://gitlab.com/gitlab-org/gitlab/-/issues/420046") do
+ route =
+ route_scope.find_by(routes: { path: path }) ||
+ route_scope.iwhere(Route.arel_table[:path] => path).take
- if follow_redirects
- route ||= redirect_route_scope.iwhere(RedirectRoute.arel_table[:path] => path).take
- end
+ if follow_redirects
+ route ||= redirect_route_scope.iwhere(RedirectRoute.arel_table[:path] => path).take
+ end
- return unless route
+ next unless route
- route.is_a?(Routable) ? route : route.source
+ route.is_a?(Routable) ? route : route.source
+ end
end
included do
@@ -46,7 +48,9 @@ module Routable
validates :route, presence: true, unless: -> { is_a?(Namespaces::ProjectNamespace) }
- scope :with_route, -> { includes(:route) }
+ scope :with_route, -> do
+ includes(:route).allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/421843')
+ end
after_validation :set_path_errors
@@ -94,7 +98,9 @@ module Routable
joins(:route)
end
- route.where(wheres.join(' OR '))
+ route
+ .where(wheres.join(' OR '))
+ .allow_cross_joins_across_databases(url: "https://gitlab.com/gitlab-org/gitlab/-/issues/420046")
end
end