Commit 778a3882 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Fix default sort for tags page

Changelog: fixed
parent e1a881c1
...@@ -16,7 +16,9 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -16,7 +16,9 @@ class Projects::TagsController < Projects::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def index def index
begin 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] @sort = tags_params[:sort]
@search = tags_params[:search] @search = tags_params[:search]
...@@ -101,10 +103,6 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -101,10 +103,6 @@ class Projects::TagsController < Projects::ApplicationController
private 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 # 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 def find_evidence_pipeline
evidence_pipeline_sha = @project.repository.commit(params[:ref])&.sha evidence_pipeline_sha = @project.repository.commit(params[:ref])&.sha
......
...@@ -17,6 +17,14 @@ RSpec.describe Projects::TagsController do ...@@ -17,6 +17,14 @@ RSpec.describe Projects::TagsController do
expect(assigns(:tags).map(&:name)).to include('v1.1.0', 'v1.0.0') expect(assigns(:tags).map(&:name)).to include('v1.1.0', 'v1.0.0')
end 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 context 'when Gitaly is unavailable' do
where(:format) do where(:format) do
[:html, :atom] [: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