Commit ab3c3fed authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '32933-graphql-remove-deprecated-method-of-decoding-cursors' into 'master'

GraphQL: remove deprecated method of decoding cursors

See merge request gitlab-org/gitlab!20496
parents cc4693d1 e3183bd0
...@@ -137,14 +137,7 @@ module Gitlab ...@@ -137,14 +137,7 @@ module Gitlab
def ordering_from_encoded_json(cursor) def ordering_from_encoded_json(cursor)
JSON.parse(decode(cursor)) JSON.parse(decode(cursor))
rescue JSON::ParserError rescue JSON::ParserError
# for the transition period where a client might request using an raise Gitlab::Graphql::Errors::ArgumentError, "Please provide a valid cursor"
# 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) }
end end
end end
end end
......
...@@ -218,23 +218,11 @@ describe Gitlab::Graphql::Connections::Keyset::Connection do ...@@ -218,23 +218,11 @@ describe Gitlab::Graphql::Connections::Keyset::Connection do
end end
end end
# TODO Enable this as part of below issue context 'when an invalid cursor is provided' do
# https://gitlab.com/gitlab-org/gitlab/issues/32933 let(:arguments) { { before: Base64Bp.urlsafe_encode64('invalidcursor', padding: false) } }
# 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) } }
it 'only returns the project before the selected one' do it 'raises an error' do
expect(subject.sliced_nodes).to contain_exactly(projects.first) expect { subject.sliced_nodes }.to raise_error(Gitlab::Graphql::Errors::ArgumentError)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment