Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-06 07:11:16 +0300
committerStan Hu <stanhu@gmail.com>2018-07-06 07:11:16 +0300
commit12b031ce8f1240785cd74f10cfdafb151c3f924b (patch)
tree05ef77b7bd9788c278eeeddab09be0ac1d2ebb44 /lib/bitbucket_server
parent022a0c2fdee1cb802b2a4999a472c1c2b760b312 (diff)
Fix pagination
Diffstat (limited to 'lib/bitbucket_server')
-rw-r--r--lib/bitbucket_server/connection.rb2
-rw-r--r--lib/bitbucket_server/paginator.rb8
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/bitbucket_server/connection.rb b/lib/bitbucket_server/connection.rb
index 092c878c93b..c5e40a3964c 100644
--- a/lib/bitbucket_server/connection.rb
+++ b/lib/bitbucket_server/connection.rb
@@ -16,7 +16,7 @@ module BitbucketServer
def get(path, extra_query = {})
response = Gitlab::HTTP.get(build_url(path),
basic_auth: auth,
- params: extra_query)
+ query: extra_query)
check_errors!(response)
response.parsed_response
diff --git a/lib/bitbucket_server/paginator.rb b/lib/bitbucket_server/paginator.rb
index c995cf4c3bd..a17045be97e 100644
--- a/lib/bitbucket_server/paginator.rb
+++ b/lib/bitbucket_server/paginator.rb
@@ -1,6 +1,6 @@
module BitbucketServer
class Paginator
- PAGE_LENGTH = 25 # The minimum length is 10 and the maximum is 100.
+ PAGE_LENGTH = 25
def initialize(connection, url, type)
@connection = connection
@@ -24,12 +24,12 @@ module BitbucketServer
page.nil? || page.next?
end
- def next_url
- page.nil? ? url : page.next
+ def next_offset
+ page.nil? ? 0 : page.next
end
def fetch_next_page
- parsed_response = connection.get(next_url, pagelen: PAGE_LENGTH, sort: :created_on)
+ parsed_response = connection.get(@url, start: next_offset, limit: PAGE_LENGTH)
Page.new(parsed_response, type)
end
end