Commit 17fe8174 authored by Douwe Maan's avatar Douwe Maan Committed by Winnie Hellmann
Browse files

Merge branch 'bvl-fix-count-with-selects' into 'master'

Remove the selects when counting the last page

Closes #40266

See merge request gitlab-org/gitlab-ce!15456

(cherry picked from commit c406824d319e5b1a073af7cf55c3f24bfa66e2a4)

5a335c4d Remove the selects when counting the last page
parent a637ca3d7a01
---
title: Fix crash when navigating to second page of the group dashbaord when there
are projects and groups on the first page
merge_request: 15456
author:
type: fixed
......@@ -55,7 +55,9 @@ def first_collection_page_count
def first_collection_last_page_size
return @first_collection_last_page_size if defined?(@first_collection_last_page_size)
@first_collection_last_page_size = paginated_first_collection(first_collection_page_count).count
@first_collection_last_page_size = paginated_first_collection(first_collection_page_count)
.except(:select)
.size
end
end
end
......@@ -280,6 +280,17 @@ def get_filtered_list
expect(assigns(:children)).to contain_exactly(other_subgroup, *next_page_projects.take(per_page - 1))
end
context 'with a mixed first page' do
let!(:first_page_subgroups) { [create(:group, :public, parent: group)] }
let!(:first_page_projects) { create_list(:project, per_page, :public, namespace: group) }
it 'correctly calculates the counts' do
get :index, group_id: group.to_param, sort: 'id_asc', page: 2, format: :json
expect(response).to have_gitlab_http_status(200)
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