From c3c92c7317df157e156c3a34ff9f4c562229479f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D=C3=A1vila?= Date: Fri, 22 Jan 2016 18:43:21 -0500 Subject: [PATCH] Make default sorting preference work for Issues and MRs. --- app/controllers/application_controller.rb | 6 ++---- features/project/issues/issues.feature | 7 +++++++ features/project/merge_requests.feature | 7 +++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 540cc30bed5..824175c8a6c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -410,10 +410,8 @@ class ApplicationController < ActionController::Base private def set_default_sort - key = if is_a_listing_page_for?('issues') - 'issues_sort' - elsif is_a_listing_page_for?('merge_requests') - 'merge_requests_sort' + key = if is_a_listing_page_for?('issues') || is_a_listing_page_for?('merge_requests') + 'issuable_sort' end cookies[key] = params[:sort] if key && params[:sort].present? diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index a91c5e0095d..0b3d03aa2a5 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -67,6 +67,13 @@ Feature: Project Issues And I visit project "Shop" issues page Then The list should be sorted by "Oldest updated" + @javascript + Scenario: Visiting Merge Requests after being sorted the list + Given I visit project "Shop" issues page + And I sort the list by "Oldest updated" + And I visit project "Shop" merge requests page + Then The list should be sorted by "Oldest updated" + @javascript Scenario: Visiting Merge Requests from a differente Project after sorting Given I visit project "Shop" merge requests page diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index 2938a22caa2..ca1ee6b3c2b 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -92,6 +92,13 @@ Feature: Project Merge Requests And I visit project "Shop" merge requests page Then The list should be sorted by "Oldest updated" + @javascript + Scenario: Visiting Issues after being sorted the list + Given I visit project "Shop" merge requests page + And I sort the list by "Oldest updated" + And I visit project "Shop" issues page + Then The list should be sorted by "Oldest updated" + @javascript Scenario: Visiting Merge Requests from a differente Project after sorting Given I visit project "Shop" merge requests page