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
20b17704
Commit
20b17704
authored
Apr 27, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take inheritance into account when presenting fields
parent
8eed9590
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
changelogs/unreleased/ajk-fix-merge-requests-assignees-web-url.yml
...s/unreleased/ajk-fix-merge-requests-assignees-web-url.yml
+5
-0
lib/gitlab/graphql/present.rb
lib/gitlab/graphql/present.rb
+3
-3
spec/lib/gitlab/graphql/present/field_extension_spec.rb
spec/lib/gitlab/graphql/present/field_extension_spec.rb
+10
-0
No files found.
changelogs/unreleased/ajk-fix-merge-requests-assignees-web-url.yml
0 → 100644
View file @
20b17704
---
title
:
Fix regression in GraphQL field MergeRequest.assignees.webUrl
merge_request
:
60428
author
:
type
:
fixed
lib/gitlab/graphql/present.rb
View file @
20b17704
...
...
@@ -10,14 +10,14 @@ module Gitlab
end
def
self
.
presenter_class
@presenter_class
@presenter_class
||
superclass
.
try
(
:presenter_class
)
end
def
self
.
present
(
object
,
attrs
)
klass
=
@
presenter_class
klass
=
presenter_class
return
object
if
!
klass
||
object
.
is_a?
(
klass
)
@presenter_c
lass
.
new
(
object
,
**
attrs
)
k
lass
.
new
(
object
,
**
attrs
)
end
end
...
...
spec/lib/gitlab/graphql/present/field_extension_spec.rb
View file @
20b17704
...
...
@@ -63,6 +63,16 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do
expect
(
value
).
to
eq
'made of concrete'
end
context
'when the implementation is inherited'
do
it
'resolves the interface field using the implementation from the presenter'
do
subclass
=
Class
.
new
(
implementation
)
{
graphql_name
'Subclass'
}
field
=
::
Types
::
BaseField
.
new
(
name: :interface_field
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
owner:
interface
)
value
=
resolve_field
(
field
,
object
,
object_type:
subclass
)
expect
(
value
).
to
eq
'made of concrete'
end
end
end
describe
'interactions with inheritance'
do
...
...
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