Commit d141b1e4 authored by Alex Kalderimis's avatar Alex Kalderimis

Allow resolvers to detect their context

parent 28ca2f91
...@@ -9,6 +9,10 @@ module Resolvers ...@@ -9,6 +9,10 @@ module Resolvers
def resolve(**args) def resolve(**args)
super.first super.first
end end
def single?
true
end
end end
end end
...@@ -17,6 +21,10 @@ module Resolvers ...@@ -17,6 +21,10 @@ module Resolvers
def resolve(**args) def resolve(**args)
super.last super.last
end end
def single?
true
end
end end
end end
...@@ -42,9 +50,13 @@ module Resolvers ...@@ -42,9 +50,13 @@ module Resolvers
override :object override :object
def object def object
super.tap do |obj| super.tap do |obj|
# If the field this resolver is used in is wrapped in a presenter, go back to it's subject # If the field this resolver is used in is wrapped in a presenter, unwrap its subject
break obj.subject if obj.is_a?(Gitlab::View::Presenter::Base) break obj.subject if obj.is_a?(Gitlab::View::Presenter::Base)
end end
end end
def single?
false
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment