diff options
Diffstat (limited to 'lib/gitlab/graphql/loaders/full_path_model_loader.rb')
-rw-r--r-- | lib/gitlab/graphql/loaders/full_path_model_loader.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/gitlab/graphql/loaders/full_path_model_loader.rb b/lib/gitlab/graphql/loaders/full_path_model_loader.rb index 26c1ce64a83..7f9013c6e4c 100644 --- a/lib/gitlab/graphql/loaders/full_path_model_loader.rb +++ b/lib/gitlab/graphql/loaders/full_path_model_loader.rb @@ -5,19 +5,20 @@ module Gitlab module Loaders # Suitable for use to find resources that expose `where_full_path_in`, # such as Project, Group, Namespace + # full path is always converted to lowercase for case-insensitive results class FullPathModelLoader attr_reader :model_class, :full_path def initialize(model_class, full_path) @model_class = model_class - @full_path = full_path + @full_path = full_path.downcase end def find BatchLoader::GraphQL.for(full_path).batch(key: model_class) do |full_paths, loader, args| # `with_route` avoids an N+1 calculating full_path args[:key].where_full_path_in(full_paths).with_route.each do |model_instance| - loader.call(model_instance.full_path, model_instance) + loader.call(model_instance.full_path.downcase, model_instance) end end end |