Commit d141b1e4 authored by Alex Kalderimis's avatar Alex Kalderimis

Allow resolvers to detect their context

parent 28ca2f91
......@@ -9,6 +9,10 @@ module Resolvers
def resolve(**args)
super.first
end
def single?
true
end
end
end
......@@ -17,6 +21,10 @@ module Resolvers
def resolve(**args)
super.last
end
def single?
true
end
end
end
......@@ -42,9 +50,13 @@ module Resolvers
override :object
def object
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)
end
end
def single?
false
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