From 4644a2daf5ec5e86e2b2989f04e99e4f081f6fef Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 4 Jun 2019 14:38:18 +0100 Subject: Add web_url to tree entry in GraphQL API --- lib/gitlab/graphql/representation/tree_entry.rb | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/gitlab/graphql/representation/tree_entry.rb (limited to 'lib') 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 -- cgit v1.2.1