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
5dd67b23
Commit
5dd67b23
authored
Nov 20, 2019
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove support for old style pagination cursors
in GraphQL
parent
14eb7a47
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
24 deletions
+5
-24
lib/gitlab/graphql/connections/keyset/connection.rb
lib/gitlab/graphql/connections/keyset/connection.rb
+1
-8
spec/lib/gitlab/graphql/connections/keyset/connection_spec.rb
.../lib/gitlab/graphql/connections/keyset/connection_spec.rb
+4
-16
No files found.
lib/gitlab/graphql/connections/keyset/connection.rb
View file @
5dd67b23
...
...
@@ -137,14 +137,7 @@ module Gitlab
def
ordering_from_encoded_json
(
cursor
)
JSON
.
parse
(
decode
(
cursor
))
rescue
JSON
::
ParserError
# for the transition period where a client might request using an
# old style cursor. Once removed, make it an error:
# raise Gitlab::Graphql::Errors::ArgumentError, "Please provide a valid cursor"
# TODO can be removed in next release
# https://gitlab.com/gitlab-org/gitlab/issues/32933
field_name
=
order_list
.
first
.
attribute_name
{
field_name
=>
decode
(
cursor
)
}
raise
Gitlab
::
Graphql
::
Errors
::
ArgumentError
,
"Please provide a valid cursor"
end
end
end
...
...
spec/lib/gitlab/graphql/connections/keyset/connection_spec.rb
View file @
5dd67b23
...
...
@@ -218,23 +218,11 @@ describe Gitlab::Graphql::Connections::Keyset::Connection do
end
end
# TODO Enable this as part of below issue
# https://gitlab.com/gitlab-org/gitlab/issues/32933
# context 'when an invalid cursor is provided' do
# let(:arguments) { { before: 'invalidcursor' } }
#
# it 'raises an error' do
# expect { expect(subject.sliced_nodes) }.to raise_error(Gitlab::Graphql::Errors::ArgumentError)
# end
# end
# TODO Remove this as part of below issue
# https://gitlab.com/gitlab-org/gitlab/issues/32933
context
'when an old style cursor is provided'
do
let
(
:arguments
)
{
{
before:
Base64Bp
.
urlsafe_encode64
(
projects
[
1
].
id
.
to_s
,
padding:
false
)
}
}
context
'when an invalid cursor is provided'
do
let
(
:arguments
)
{
{
before:
Base64Bp
.
urlsafe_encode64
(
'invalidcursor'
,
padding:
false
)
}
}
it
'
only returns the project before the selected one
'
do
expect
(
subject
.
sliced_nodes
).
to
contain_exactly
(
projects
.
first
)
it
'
raises an error
'
do
expect
{
expect
(
subject
.
sliced_nodes
)
}.
to
raise_error
(
Gitlab
::
Graphql
::
Errors
::
ArgumentError
)
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