Commit 329566d0 authored by Lee Tickett's avatar Lee Tickett Committed by Mayra Cabrera

Change Default Project Listing Sort Order (to Name)

parent 628f756f
......@@ -108,7 +108,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
end
def default_sort_order
sort_value_latest_activity
sort_value_name
end
def sorting_field
......
......@@ -94,7 +94,7 @@ class Explore::ProjectsController < Explore::ApplicationController
end
def default_sort_order
sort_value_latest_activity
sort_value_name
end
def sorting_field
......
......@@ -176,7 +176,7 @@ class GroupDescendantsFinder
end
def sort
params.fetch(:sort, 'created_desc')
params.fetch(:sort, 'name_asc')
end
# rubocop: disable CodeReuse/ActiveRecord
......
---
title: Change default project listing sort order to name
merge_request: 47734
author: Lee Tickett
type: changed
......@@ -36,7 +36,7 @@ RSpec.describe 'Dashboard Archived Project' do
end
it 'searches archived projects', :js do
click_button 'Last updated'
click_button 'Name'
click_link 'Show archived projects'
expect(page).to have_link(project.name)
......
......@@ -173,11 +173,11 @@ RSpec.describe 'Dashboard > User filters projects' do
end
end
it 'defaults to "Last updated"', :js do
it 'defaults to "Name"', :js do
page.find('.filtered-search-block #filtered-search-sorting-dropdown').click
active_sorting_option = page.first('.filtered-search-block #filtered-search-sorting-dropdown .is-active')
expect(active_sorting_option).to have_content 'Last updated'
expect(active_sorting_option).to have_content 'Name'
end
context 'Sorting by name' do
......
......@@ -77,9 +77,9 @@ RSpec.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)
it 'sorts elements by name as default' do
project1 = create(:project, namespace: group, name: 'z')
project2 = create(:project, namespace: group, name: 'a')
expect(subject.execute).to eq([project2, project1])
end
......
......@@ -9,13 +9,13 @@ RSpec.shared_context 'GroupProjectsFinder context' do
let(:finder) { described_class.new(group: group, current_user: current_user, params: params, options: options) }
let_it_be(:public_project) { create(:project, :public, group: group, path: '1') }
let_it_be(:private_project) { create(:project, :private, group: group, path: '2') }
let_it_be(:shared_project_1) { create(:project, :public, path: '3') }
let_it_be(:shared_project_2) { create(:project, :private, path: '4') }
let_it_be(:shared_project_3) { create(:project, :internal, path: '5') }
let_it_be(:subgroup_project) { create(:project, :public, path: '6', group: subgroup) }
let_it_be(:subgroup_private_project) { create(:project, :private, path: '7', group: subgroup) }
let_it_be(:public_project) { create(:project, :public, group: group, path: '1', name: 'g') }
let_it_be(:private_project) { create(:project, :private, group: group, path: '2', name: 'f') }
let_it_be(:shared_project_1) { create(:project, :public, path: '3', name: 'e') }
let_it_be(:shared_project_2) { create(:project, :private, path: '4', name: 'd') }
let_it_be(:shared_project_3) { create(:project, :internal, path: '5', name: 'c') }
let_it_be(:subgroup_project) { create(:project, :public, path: '6', group: subgroup, name: 'b') }
let_it_be(:subgroup_private_project) { create(:project, :private, path: '7', group: subgroup, name: 'a') }
before do
shared_project_1.project_group_links.create!(group_access: Gitlab::Access::MAINTAINER, group: group)
......
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