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:
authorLin Jen-Shin <godfat@godfat.org>2019-06-28 13:02:57 +0300
committerLin Jen-Shin <godfat@godfat.org>2019-06-28 13:02:57 +0300
commit2321b337f1487031e2cab8e1a4e778f3aaf8e2da (patch)
tree09ac0a7fe65e4da93f873e4b8cf02b57cd359791 /lib/gitlab/graphql
parent1012cfb0b780bc9348a8478a66af2a337a69b0f6 (diff)
parentd78f7ceac94abe0e8318c6472fc5f7967325a74f (diff)
Merge branch 'graphql-tree-last-commit' into 'master'
Added commit type to tree GraphQL type See merge request gitlab-org/gitlab-ce!29412
Diffstat (limited to 'lib/gitlab/graphql')
-rw-r--r--lib/gitlab/graphql/loaders/pipeline_for_sha_loader.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/loaders/pipeline_for_sha_loader.rb b/lib/gitlab/graphql/loaders/pipeline_for_sha_loader.rb
new file mode 100644
index 00000000000..81c5cabf451
--- /dev/null
+++ b/lib/gitlab/graphql/loaders/pipeline_for_sha_loader.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Graphql
+ module Loaders
+ class PipelineForShaLoader
+ attr_accessor :project, :sha
+
+ def initialize(project, sha)
+ @project, @sha = project, sha
+ end
+
+ def find_last
+ BatchLoader.for(sha).batch(key: project) do |shas, loader, args|
+ pipelines = args[:key].ci_pipelines.latest_for_shas(shas)
+
+ pipelines.each do |pipeline|
+ loader.call(pipeline.sha, pipeline)
+ end
+ end
+ end
+ end
+ end
+ end
+end