diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-21 15:19:00 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-21 15:19:00 +0100 |
commit | 468b47d47c004f7a7a2eef7dace2a0b808df9175 (patch) | |
tree | 3e0a07337a795c2fcc7d81a39ccd05bd1ae12f0c /lib/api/helpers.rb | |
parent | 63bb849145a5f38eb27a633d532171f7c17a63aa (diff) | |
download | gitlab-ce-468b47d47c004f7a7a2eef7dace2a0b808df9175.tar.gz |
Remove redundant pagination helpers after a bad merge
[ci skip]
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 15ac29b2625..106694e13df 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -356,38 +356,6 @@ module API @sudo_identifier ||= params[SUDO_PARAM] || env[SUDO_HEADER] end - def add_pagination_headers(paginated_data) - header 'X-Total', paginated_data.total_count.to_s - header 'X-Total-Pages', paginated_data.total_pages.to_s - header 'X-Per-Page', paginated_data.limit_value.to_s - header 'X-Page', paginated_data.current_page.to_s - header 'X-Next-Page', paginated_data.next_page.to_s - header 'X-Prev-Page', paginated_data.prev_page.to_s - header 'Link', pagination_links(paginated_data) - end - - def pagination_links(paginated_data) - request_url = request.url.split('?').first - request_params = params.clone - request_params[:per_page] = paginated_data.limit_value - - links = [] - - request_params[:page] = paginated_data.current_page - 1 - links << %(<#{request_url}?#{request_params.to_query}>; rel="prev") unless paginated_data.first_page? - - request_params[:page] = paginated_data.current_page + 1 - links << %(<#{request_url}?#{request_params.to_query}>; rel="next") unless paginated_data.last_page? - - request_params[:page] = 1 - links << %(<#{request_url}?#{request_params.to_query}>; rel="first") - - request_params[:page] = paginated_data.total_pages - links << %(<#{request_url}?#{request_params.to_query}>; rel="last") - - links.join(', ') - end - def secret_token Gitlab::Shell.secret_token end |