Commit b4550139 authored by Jacopo's avatar Jacopo

Fix default sorting for subgroups and projects list

parent 28e3a90b
......@@ -178,7 +178,7 @@ class GroupDescendantsFinder
end
def sort
params.fetch(:sort, 'id_asc')
params.fetch(:sort, 'created_desc')
end
# rubocop: disable CodeReuse/ActiveRecord
......
---
title: Fix default sorting for subgroups and projects list
merge_request: 23058
author: Jacopo Beschi @jacopo-beschi
type: fixed
......@@ -74,6 +74,13 @@ describe GroupDescendantsFinder do
end
end
it 'sorts elements by latest created as default' do
project1 = create(:project, namespace: group, created_at: 1.hour.ago)
project2 = create(:project, namespace: group)
expect(subject.execute).to eq([project2, project1])
end
context 'sorting by name' do
let!(:project1) { create(:project, namespace: group, name: 'a', path: 'project-a') }
let!(:project2) { create(:project, namespace: group, name: 'z', path: 'project-z') }
......
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