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:
authorJohn T Skarbek <jskarbek@gitlab.com>2019-07-18 22:53:56 +0300
committerJohn T Skarbek <jskarbek@gitlab.com>2019-07-18 22:53:56 +0300
commitad83b673245a1dd0f65cea76ff6b6113f107d30e (patch)
tree4ab1e5be43521887067f9f8a6e23ec45dbfdcbe0 /lib/gitlab/graphql/representation/submodule_tree_entry.rb
parent0d9afa5d6c7aa7a927cbb20aef2a4fce586748d4 (diff)
parent17b9a91cc0622ad5cac6b1a11546b9ef9e8ac427 (diff)
Merge remote-tracking branch 'origin/12-1-auto-deploy-20190718' into 12-1-stable
Diffstat (limited to 'lib/gitlab/graphql/representation/submodule_tree_entry.rb')
-rw-r--r--lib/gitlab/graphql/representation/submodule_tree_entry.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/representation/submodule_tree_entry.rb b/lib/gitlab/graphql/representation/submodule_tree_entry.rb
new file mode 100644
index 00000000000..65716dff75d
--- /dev/null
+++ b/lib/gitlab/graphql/representation/submodule_tree_entry.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Graphql
+ module Representation
+ class SubmoduleTreeEntry < SimpleDelegator
+ class << self
+ def decorate(submodules, tree)
+ repository = tree.repository
+ submodule_links = Gitlab::SubmoduleLinks.new(repository)
+
+ submodules.map do |submodule|
+ self.new(submodule, submodule_links.for(submodule, tree.sha))
+ end
+ end
+ end
+
+ def initialize(submodule, submodule_links)
+ @submodule_links = submodule_links
+
+ super(submodule)
+ end
+
+ def web_url
+ @submodule_links.first
+ end
+
+ def tree_url
+ @submodule_links.last
+ end
+ end
+ end
+ end
+end