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
1871caf3
Commit
1871caf3
authored
Apr 04, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
1cd8bd0a
6d000c9f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
app/graphql/gitlab_schema.rb
app/graphql/gitlab_schema.rb
+1
-1
spec/graphql/gitlab_schema_spec.rb
spec/graphql/gitlab_schema_spec.rb
+12
-2
No files found.
app/graphql/gitlab_schema.rb
View file @
1871caf3
...
@@ -31,7 +31,7 @@ class GitlabSchema < GraphQL::Schema
...
@@ -31,7 +31,7 @@ class GitlabSchema < GraphQL::Schema
end
end
def
self
.
max_query_complexity
(
ctx
)
def
self
.
max_query_complexity
(
ctx
)
current_user
=
ctx
&
.
fetch
(
:current_user
)
current_user
=
ctx
&
.
fetch
(
:current_user
,
nil
)
if
current_user
&
.
admin
if
current_user
&
.
admin
ADMIN_COMPLEXITY
ADMIN_COMPLEXITY
...
...
spec/graphql/gitlab_schema_spec.rb
View file @
1871caf3
...
@@ -34,12 +34,22 @@ describe GitlabSchema do
...
@@ -34,12 +34,22 @@ describe GitlabSchema do
end
end
context
'for different types of users'
do
context
'for different types of users'
do
it
'returns DEFAULT_MAX_COMPLEXITY for no user'
do
it
'returns DEFAULT_MAX_COMPLEXITY for no context'
do
expect
(
GraphQL
::
Schema
).
to
receive
(
:execute
).
with
(
'query'
,
hash_including
(
max_complexity:
GitlabSchema
::
DEFAULT_MAX_COMPLEXITY
))
expect
(
GraphQL
::
Schema
)
.
to
receive
(
:execute
)
.
with
(
'query'
,
hash_including
(
max_complexity:
GitlabSchema
::
DEFAULT_MAX_COMPLEXITY
))
described_class
.
execute
(
'query'
)
described_class
.
execute
(
'query'
)
end
end
it
'returns DEFAULT_MAX_COMPLEXITY for no user'
do
expect
(
GraphQL
::
Schema
)
.
to
receive
(
:execute
)
.
with
(
'query'
,
hash_including
(
max_complexity:
GitlabSchema
::
DEFAULT_MAX_COMPLEXITY
))
described_class
.
execute
(
'query'
,
context:
{})
end
it
'returns AUTHENTICATED_COMPLEXITY for a logged in user'
do
it
'returns AUTHENTICATED_COMPLEXITY for a logged in user'
do
user
=
build
:user
user
=
build
:user
...
...
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