Skip to content
Snippets Groups Projects
Unverified Commit b9bc9d0b authored by Daniel M Brasil's avatar Daniel M Brasil Committed by GitHub
Browse files

Fix incorrect pagination headers in `/api/v2/admin/accounts` (#25477)

parent 0a0a1f14
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,14 @@ class Api::V2::Admin::AccountsController < Api::V1::Admin::AccountsController
private
def next_path
api_v2_admin_accounts_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
def prev_path
api_v2_admin_accounts_url(pagination_params(min_id: pagination_since_id)) unless @accounts.empty?
end
def filtered_accounts
AccountFilter.new(translated_filter_params).results
end
......
......@@ -55,5 +55,13 @@ RSpec.describe Api::V2::Admin::AccountsController do
end
end
end
context 'with limit param' do
let(:params) { { limit: 1 } }
it 'sets the correct pagination headers' do
expect(response.headers['Link'].find_link(%w(rel next)).href).to eq api_v2_admin_accounts_url(limit: 1, max_id: admin_account.id)
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment