Commit b4550139 authored by Jacopo's avatar Jacopo

Fix default sorting for subgroups and projects list

parent 28e3a90b
...@@ -178,7 +178,7 @@ class GroupDescendantsFinder ...@@ -178,7 +178,7 @@ class GroupDescendantsFinder
end end
def sort def sort
params.fetch(:sort, 'id_asc') params.fetch(:sort, 'created_desc')
end end
# rubocop: disable CodeReuse/ActiveRecord # 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 ...@@ -74,6 +74,13 @@ describe GroupDescendantsFinder do
end end
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 context 'sorting by name' do
let!(:project1) { create(:project, namespace: group, name: 'a', path: 'project-a') } let!(:project1) { create(:project, namespace: group, name: 'a', path: 'project-a') }
let!(:project2) { create(:project, namespace: group, name: 'z', path: 'project-z') } 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