Commit e049fe0d authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'issue-63222' into 'master'

Set default project sort method prior to initial sort on page loading

Closes #63222

See merge request gitlab-org/gitlab-ce!29830
parents c47eef94 643100a9
...@@ -7,8 +7,8 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController ...@@ -7,8 +7,8 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) } prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) }
before_action :set_non_archived_param before_action :set_non_archived_param
before_action :projects, only: [:index]
before_action :default_sorting before_action :default_sorting
before_action :projects, only: [:index]
skip_cross_project_access_check :index, :starred skip_cross_project_access_check :index, :starred
def index def index
......
---
title: Set default sort method for dashboard projects list
merge_request: 29830
author: David Palubin
type: fixed
...@@ -11,8 +11,10 @@ describe Dashboard::ProjectsController do ...@@ -11,8 +11,10 @@ describe Dashboard::ProjectsController do
end end
context 'user logged in' do context 'user logged in' do
let(:user) { create(:user) }
before do before do
sign_in create(:user) sign_in(user)
end end
context 'external authorization' do context 'external authorization' do
...@@ -24,6 +26,20 @@ describe Dashboard::ProjectsController do ...@@ -24,6 +26,20 @@ describe Dashboard::ProjectsController do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
end end
end end
it 'orders the projects by last activity by default' do
project = create(:project)
project.add_developer(user)
project.update!(last_repository_updated_at: 3.days.ago, last_activity_at: 3.days.ago)
project2 = create(:project)
project2.add_developer(user)
project2.update!(last_repository_updated_at: 10.days.ago, last_activity_at: 10.days.ago)
get :index
expect(assigns(:projects)).to eq([project, project2])
end
end end
end end
......
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