diff options
| author | Igor Drozdov <idrozdov@gitlab.com> | 2019-06-17 13:00:30 +0300 |
|---|---|---|
| committer | Igor Drozdov <idrozdov@gitlab.com> | 2019-06-17 13:10:05 +0300 |
| commit | 1c1954e70e91092f5bbd4042dd5e1793cfab22ff (patch) | |
| tree | a01d4fa72f3916c1835de05f3069a5b4258cd510 /lib | |
| parent | 814e1af72e654aa5f8ea9e200c26ce8ea99954df (diff) | |
| download | gitlab-ce-id-graphql-tree-commit.tar.gz | |
Remove N+1 from LastCommitResolverid-graphql-tree-commit
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gitlab/graphql/representation/tree_entry.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/gitlab/graphql/representation/tree_entry.rb b/lib/gitlab/graphql/representation/tree_entry.rb index 7ea83db5876..4467c6634ea 100644 --- a/lib/gitlab/graphql/representation/tree_entry.rb +++ b/lib/gitlab/graphql/representation/tree_entry.rb @@ -5,23 +5,24 @@ module Gitlab module Representation class TreeEntry < SimpleDelegator class << self - def decorate(entries, repository) + def decorate(entries, tree) return if entries.nil? entries.map do |entry| if entry.is_a?(TreeEntry) entry else - self.new(entry, repository) + self.new(entry, tree) end end end end - attr_accessor :repository + attr_accessor :tree + delegate :repository, to: :tree - def initialize(raw_entry, repository) - @repository = repository + def initialize(raw_entry, tree) + @tree = tree super(raw_entry) end |
