gitlab-org--gitlab-foss/lib/gitlab/graphql/loaders/batch_lfs_oid_loader.rb
Brett Walker aa7b1cfc5b Upgrade GraphQL gem to 1.8.17
- Due to https://github.com/exAspArk/batch-loader/pull/32,
we  changed BatchLoader.for into BatchLoader::GraphQL.for
- since our results are wrapped in a BatchLoader::GraphQL,
calling `sync` during authorization is required to get real object
- `graphql` now has it's own authorization system.  Our
`authorized?` method conflicted and required renaming
2019-09-04 17:42:48 +00:00

25 lines
632 B
Ruby

# frozen_string_literal: true
module Gitlab
module Graphql
module Loaders
class BatchLfsOidLoader
def initialize(repository, blob_id)
@repository, @blob_id = repository, blob_id
end
def find
BatchLoader::GraphQL.for(blob_id).batch(key: repository) do |blob_ids, loader, batch_args|
Gitlab::Git::Blob.batch_lfs_pointers(batch_args[:key], blob_ids).each do |loaded_blob|
loader.call(loaded_blob.id, loaded_blob.lfs_oid)
end
end
end
private
attr_reader :repository, :blob_id
end
end
end
end