diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index f0db765d2..c0c78ade4 100644 --- a/app/views/debates/index.html.erb +++ b/app/views/debates/index.html.erb @@ -30,7 +30,7 @@ <% @valid_orders.each do |order| %> - value='<%= current_path_with_query_params(order: order) %>'> + value='<%= current_path_with_query_params(order: order, page: 1) %>'> <%= t("debates.index.orders.#{order}") %> <% end %> diff --git a/app/views/shared/_filter_subnav.html.erb b/app/views/shared/_filter_subnav.html.erb index 0f8975aa3..0bf9f773c 100644 --- a/app/views/shared/_filter_subnav.html.erb +++ b/app/views/shared/_filter_subnav.html.erb @@ -11,7 +11,7 @@ <%= t("#{i18n_namespace}.filters.#{filter}") %> <% else %> <%= link_to t("#{i18n_namespace}.filters.#{filter}"), - current_path_with_query_params(filter: filter) %> + current_path_with_query_params(filter: filter, page: 1) %> <% end %> <% end %> diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index bcddab7a4..301e9113d 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -384,6 +384,7 @@ feature 'Debates' do end expect(current_url).to include('order=hot_score') + expect(current_url).to include('page=1') end scenario 'Debates are ordered by most commented', :js do @@ -400,6 +401,7 @@ feature 'Debates' do end expect(current_url).to include('order=most_commented') + expect(current_url).to include('page=1') end scenario 'Debates are ordered by newest', :js do @@ -416,6 +418,7 @@ feature 'Debates' do end expect(current_url).to include('order=created_at') + expect(current_url).to include('page=1') end scenario 'Debates are ordered randomly', :js do @@ -432,6 +435,7 @@ feature 'Debates' do debates_second_time = find("#debates.js-order-random").text expect(debates_first_time).to_not eq(debates_second_time) + expect(current_url).to include('page=1') end end