summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2019-06-04 14:38:18 +0100
committerPhil Hughes <me@iamphill.com>2019-06-05 08:46:32 +0100
commit4644a2daf5ec5e86e2b2989f04e99e4f081f6fef (patch)
tree40c9376ce43f2c2b9d964fb67b1c35cfb0077773 /lib
parentdf549eb28c83b27500619ccb14c201a4ff87daa3 (diff)
downloadgitlab-ce-4644a2daf5ec5e86e2b2989f04e99e4f081f6fef.tar.gz
Add web_url to tree entry in GraphQL API
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/graphql/representation/tree_entry.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/representation/tree_entry.rb b/lib/gitlab/graphql/representation/tree_entry.rb
new file mode 100644
index 00000000000..7ea83db5876
--- /dev/null
+++ b/lib/gitlab/graphql/representation/tree_entry.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Graphql
+ module Representation
+ class TreeEntry < SimpleDelegator
+ class << self
+ def decorate(entries, repository)
+ return if entries.nil?
+
+ entries.map do |entry|
+ if entry.is_a?(TreeEntry)
+ entry
+ else
+ self.new(entry, repository)
+ end
+ end
+ end
+ end
+
+ attr_accessor :repository
+
+ def initialize(raw_entry, repository)
+ @repository = repository
+
+ super(raw_entry)
+ end
+ end
+ end
+ end
+end