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
c153ce12
Commit
c153ce12
authored
Apr 11, 2022
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove use of accepts_definition
as it’s deprecated in graphql 1.13.12 and removed in 2.x
parent
46b38736
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
5 deletions
+26
-5
app/graphql/types/base_object.rb
app/graphql/types/base_object.rb
+5
-0
config/initializers/graphql.rb
config/initializers/graphql.rb
+0
-5
spec/graphql/types/base_object_spec.rb
spec/graphql/types/base_object_spec.rb
+21
-0
No files found.
app/graphql/types/base_object.rb
View file @
c153ce12
...
@@ -9,6 +9,11 @@ module Types
...
@@ -9,6 +9,11 @@ module Types
field_class
Types
::
BaseField
field_class
Types
::
BaseField
edge_type_class
Types
::
BaseEdge
edge_type_class
Types
::
BaseEdge
def
self
.
authorize
(
*
args
)
@authorize_args
=
args
if
args
.
any?
@authorize_args
||
(
superclass
.
respond_to?
(
:authorize
)
?
superclass
.
authorize
:
nil
)
end
def
self
.
accepts
(
*
types
)
def
self
.
accepts
(
*
types
)
@accepts
||=
[]
@accepts
||=
[]
@accepts
+=
types
@accepts
+=
types
...
...
config/initializers/graphql.rb
deleted
100644 → 0
View file @
46b38736
# frozen_string_literal: true
GraphQL
::
ObjectType
.
accepts_definitions
(
authorize:
GraphQL
::
Define
.
assign_metadata_key
(
:authorize
))
GraphQL
::
Schema
::
Object
.
accepts_definition
(
:authorize
)
spec/graphql/types/base_object_spec.rb
View file @
c153ce12
...
@@ -428,5 +428,26 @@ RSpec.describe Types::BaseObject do
...
@@ -428,5 +428,26 @@ RSpec.describe Types::BaseObject do
expect
(
result
.
dig
(
'data'
,
'users'
,
'nodes'
))
expect
(
result
.
dig
(
'data'
,
'users'
,
'nodes'
))
.
to
contain_exactly
({
'name'
=>
active_users
.
first
.
name
})
.
to
contain_exactly
({
'name'
=>
active_users
.
first
.
name
})
end
end
describe
'.authorize'
do
let_it_be
(
:read_only_type
)
do
Class
.
new
(
described_class
)
do
authorize
:read_only
end
end
let_it_be
(
:inherited_read_only_type
)
{
Class
.
new
(
read_only_type
)
}
it
'keeps track of the specified value'
do
expect
(
described_class
.
authorize
).
to
be_nil
expect
(
read_only_type
.
authorize
).
to
match_array
[
:read_only
]
expect
(
inherited_read_only_type
.
authorize
).
to
match_array
[
:read_only
]
read_only_type
.
authorize
(
:write_only
)
expect
(
read_only_type
.
authorize
).
to
match_array
[
:write_only
]
expect
(
inherited_read_only_type
.
authorize
).
to
match_array
[
:write_only
]
end
end
end
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