Commit 3235388c authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'reinstate-keyset-pagination-branches-overview' into 'master'

Reinstate branches keyset pagination on overview page

See merge request gitlab-org/gitlab!62458
parents f4dc6457 a4bdb63b
......@@ -185,18 +185,12 @@ class Projects::BranchesController < Projects::ApplicationController
# Here we get one more branch to indicate if there are more data we're not showing
limit = @overview_max_branches + 1
if Feature.enabled?(:branch_list_keyset_pagination, project, default_enabled: :yaml)
@active_branches =
BranchesFinder.new(@repository, { per_page: limit, sort: sort_value_recently_updated })
.execute(gitaly_pagination: true).select(&:active?)
@stale_branches =
BranchesFinder.new(@repository, { per_page: limit, sort: sort_value_oldest_updated })
.execute(gitaly_pagination: true).select(&:stale?)
else
@active_branches, @stale_branches = BranchesFinder.new(@repository, sort: sort_value_recently_updated).execute.partition(&:active?)
@active_branches = @active_branches.first(limit)
@stale_branches = @stale_branches.first(limit)
end
@active_branches =
BranchesFinder.new(@repository, { per_page: limit, sort: sort_value_recently_updated })
.execute(gitaly_pagination: true).select(&:active?)
@stale_branches =
BranchesFinder.new(@repository, { per_page: limit, sort: sort_value_oldest_updated })
.execute(gitaly_pagination: true).select(&:stale?)
@branches = @active_branches + @stale_branches
end
......
......@@ -655,21 +655,6 @@ RSpec.describe Projects::BranchesController do
["feature", "improve/awesome", "merge-test", "markdown", "feature_conflict", "'test'"]
)
end
context 'branch_list_keyset_pagination is disabled' do
before do
stub_feature_flags(branch_list_keyset_pagination: false)
end
it 'sets active and stale branches' do
expect(assigns[:active_branches].map(&:name)).not_to include(
"feature", "improve/awesome", "merge-test", "markdown", "feature_conflict", "'test'"
)
expect(assigns[:stale_branches].map(&:name)).to eq(
["feature", "improve/awesome", "merge-test", "markdown", "feature_conflict", "'test'"]
)
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