Commit aee255a2 authored by Thong Kuah's avatar Thong Kuah

Revert explore projects default sort to last updated

Otherwise projects can easily be gamed to appear in the
https://gitlab.com/explore/projects page easily.
parent 2f64b88d
...@@ -97,7 +97,7 @@ class Explore::ProjectsController < Explore::ApplicationController ...@@ -97,7 +97,7 @@ class Explore::ProjectsController < Explore::ApplicationController
end end
def default_sort_order def default_sort_order
sort_value_name sort_value_latest_activity
end end
def sorting_field def sorting_field
......
---
title: Reverts default sort order for Explore Projects to Last updated
merge_request: 54879
author:
type: changed
...@@ -4,6 +4,8 @@ require 'spec_helper' ...@@ -4,6 +4,8 @@ require 'spec_helper'
RSpec.describe Explore::ProjectsController do RSpec.describe Explore::ProjectsController do
shared_examples 'explore projects' do shared_examples 'explore projects' do
let(:expected_default_sort) { 'latest_activity_desc' }
describe 'GET #index.json' do describe 'GET #index.json' do
render_views render_views
...@@ -12,6 +14,11 @@ RSpec.describe Explore::ProjectsController do ...@@ -12,6 +14,11 @@ RSpec.describe Explore::ProjectsController do
end end
it { is_expected.to respond_with(:success) } it { is_expected.to respond_with(:success) }
it 'sets a default sort parameter' do
expect(controller.params[:sort]).to eq(expected_default_sort)
expect(assigns[:sort]).to eq(expected_default_sort)
end
end end
describe 'GET #trending.json' do describe 'GET #trending.json' do
...@@ -22,6 +29,11 @@ RSpec.describe Explore::ProjectsController do ...@@ -22,6 +29,11 @@ RSpec.describe Explore::ProjectsController do
end end
it { is_expected.to respond_with(:success) } it { is_expected.to respond_with(:success) }
it 'sets a default sort parameter' do
expect(controller.params[:sort]).to eq(expected_default_sort)
expect(assigns[:sort]).to eq(expected_default_sort)
end
end end
describe 'GET #starred.json' do describe 'GET #starred.json' do
...@@ -32,6 +44,11 @@ RSpec.describe Explore::ProjectsController do ...@@ -32,6 +44,11 @@ RSpec.describe Explore::ProjectsController do
end end
it { is_expected.to respond_with(:success) } it { is_expected.to respond_with(:success) }
it 'sets a default sort parameter' do
expect(controller.params[:sort]).to eq(expected_default_sort)
expect(assigns[:sort]).to eq(expected_default_sort)
end
end end
describe 'GET #trending' do describe 'GET #trending' do
......
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