Commit f92ed987 authored by Sincheol (David) Kim's avatar Sincheol (David) Kim

Merge branch 'fix_default_sort_for_tags_page' into 'master'

Fix default sort for tags page

See merge request gitlab-org/gitlab!80232
parents c3e67884 778a3882
......@@ -16,7 +16,9 @@ class Projects::TagsController < Projects::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def index
begin
tags_params[:sort] = tags_params[:sort].presence || sort_value_recently_updated
tags_params = params
.permit(:search, :sort, :per_page, :page_token, :page)
.with_defaults(sort: sort_value_recently_updated)
@sort = tags_params[:sort]
@search = tags_params[:search]
......@@ -101,10 +103,6 @@ class Projects::TagsController < Projects::ApplicationController
private
def tags_params
params.permit(:search, :sort, :per_page, :page_token, :page)
end
# TODO: remove this with the release creation moved to it's own form https://gitlab.com/gitlab-org/gitlab/-/issues/214245
def find_evidence_pipeline
evidence_pipeline_sha = @project.repository.commit(params[:ref])&.sha
......
......@@ -17,6 +17,14 @@ RSpec.describe Projects::TagsController do
expect(assigns(:tags).map(&:name)).to include('v1.1.0', 'v1.0.0')
end
context 'default sort for tags' do
it 'sorts tags by recently updated' do
subject
expect(assigns(:sort)).to eq('updated_desc')
end
end
context 'when Gitaly is unavailable' do
where(:format) do
[:html, :atom]
......
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