diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb index 07ec129dea3..6524ba55a16 100644 --- a/app/helpers/sorting_helper.rb +++ b/app/helpers/sorting_helper.rb @@ -142,7 +142,9 @@ module SortingHelper { sort_value_oldest_created => sort_value_created_date, sort_value_oldest_updated => sort_value_recently_updated, - sort_value_milestone_later => sort_value_milestone + sort_value_milestone_later => sort_value_milestone, + sort_value_due_date_later => sort_value_due_date, + sort_value_least_popular => sort_value_popularity } end @@ -151,7 +153,11 @@ module SortingHelper sort_value_created_date => sort_value_oldest_created, sort_value_recently_created => sort_value_oldest_created, sort_value_recently_updated => sort_value_oldest_updated, - sort_value_milestone => sort_value_milestone_later + sort_value_milestone => sort_value_milestone_later, + sort_value_due_date => sort_value_due_date_later, + sort_value_due_date_soon => sort_value_due_date_later, + sort_value_popularity => sort_value_least_popular, + sort_value_most_popular => sort_value_least_popular }.merge(issuable_sort_option_overrides) end @@ -420,6 +426,14 @@ module SortingHelper 'popularity' end + def sort_value_most_popular + 'popularity_desc' + end + + def sort_value_least_popular + 'popularity_asc' + end + def sort_value_priority 'priority' end diff --git a/changelogs/unreleased/50926-sort-by-due-date-and-popularity.yml b/changelogs/unreleased/50926-sort-by-due-date-and-popularity.yml new file mode 100644 index 00000000000..7efc800be1e --- /dev/null +++ b/changelogs/unreleased/50926-sort-by-due-date-and-popularity.yml @@ -0,0 +1,5 @@ +--- +title: Sort by due date and popularity in both directions for Issues and Merge requests +merge_request: 25502 +author: Nermin Vehabovic +type: changed diff --git a/spec/features/issuables/sorting_list_spec.rb b/spec/features/issuables/sorting_list_spec.rb index 0601dd47c03..3a46a4e0167 100644 --- a/spec/features/issuables/sorting_list_spec.rb +++ b/spec/features/issuables/sorting_list_spec.rb @@ -86,26 +86,26 @@ describe 'Sort Issuable List' do expect(last_merge_request).to include(first_created_issuable.title) end end + end - context 'custom sorting' do - let(:issuable_type) { :merge_request } + context 'custom sorting' do + let(:issuable_type) { :merge_request } - it 'supports sorting in asc and desc order' do - visit_merge_requests_with_state(project, 'open') + it 'supports sorting in asc and desc order' do + visit_merge_requests_with_state(project, 'open') - page.within('.issues-other-filters') do - click_button('Created date') - click_link('Last updated') - end - - expect(first_merge_request).to include(last_updated_issuable.title) - expect(last_merge_request).to include(first_updated_issuable.title) - - find('.issues-other-filters .filter-dropdown-container .qa-reverse-sort').click - - expect(first_merge_request).to include(first_updated_issuable.title) - expect(last_merge_request).to include(last_updated_issuable.title) + page.within('.issues-other-filters') do + click_button('Created date') + click_link('Last updated') end + + expect(first_merge_request).to include(last_updated_issuable.title) + expect(last_merge_request).to include(first_updated_issuable.title) + + find('.issues-other-filters .filter-dropdown-container .qa-reverse-sort').click + + expect(first_merge_request).to include(first_updated_issuable.title) + expect(last_merge_request).to include(last_updated_issuable.title) end end end