Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d141b1e4
Commit
d141b1e4
authored
Dec 05, 2019
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow resolvers to detect their context
parent
28ca2f91
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
app/graphql/resolvers/base_resolver.rb
app/graphql/resolvers/base_resolver.rb
+13
-1
No files found.
app/graphql/resolvers/base_resolver.rb
View file @
d141b1e4
...
...
@@ -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 it
s subject
break
obj
.
subject
if
obj
.
is_a?
(
Gitlab
::
View
::
Presenter
::
Base
)
end
end
def
single?
false
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment