Commit 0d23755c authored by John Hope's avatar John Hope

Move set_issuables_index back into the controller callback cycle

parent a7d28aca
......@@ -28,7 +28,7 @@ module IssuableCollections
unless pagination_disabled?
set_pagination
return if html_request? && redirect_out_of_range(@issuables, @total_pages)
return if redirect_out_of_range(@issuables, @total_pages)
end
if params[:label_name].present? && @project
......
......@@ -10,7 +10,7 @@ class Projects::IssuesController < Projects::ApplicationController
include RecordUserLastActivity
ISSUES_EXCEPT_ACTIONS = %i[index calendar new create bulk_update import_csv export_csv service_desk].freeze
SET_ISSUABLES_INDEX_ONLY_ACTIONS = %i[calendar service_desk].freeze
SET_ISSUABLES_INDEX_ONLY_ACTIONS = %i[index calendar service_desk].freeze
prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) }
prepend_before_action(only: [:calendar]) { authenticate_sessionless_user!(:ics) }
......@@ -22,7 +22,9 @@ class Projects::IssuesController < Projects::ApplicationController
before_action :issue, unless: ->(c) { ISSUES_EXCEPT_ACTIONS.include?(c.action_name.to_sym) }
after_action :log_issue_show, unless: ->(c) { ISSUES_EXCEPT_ACTIONS.include?(c.action_name.to_sym) }
before_action :set_issuables_index, if: ->(c) { SET_ISSUABLES_INDEX_ONLY_ACTIONS.include?(c.action_name.to_sym) }
before_action :set_issuables_index, if: ->(c) {
SET_ISSUABLES_INDEX_ONLY_ACTIONS.include?(c.action_name.to_sym) && !vue_issues_list?
}
# Allow write(create) issue
before_action :authorize_create_issue!, only: [:new, :create]
......@@ -71,10 +73,9 @@ class Projects::IssuesController < Projects::ApplicationController
attr_accessor :vulnerability_id
def index
if html_request? && Feature.enabled?(:vue_issues_list, project&.group, default_enabled: :yaml)
if vue_issues_list?
set_sort_order
else
set_issuables_index
@issues = @issuables
end
......@@ -248,6 +249,12 @@ class Projects::IssuesController < Projects::ApplicationController
protected
def vue_issues_list?
action_name.to_sym == :index &&
html_request? &&
Feature.enabled?(:vue_issues_list, project&.group, default_enabled: :yaml)
end
def sorting_field
Issue::SORTING_PREFERENCE_FIELD
end
......
......@@ -151,8 +151,8 @@ RSpec.describe Projects::IssuesController do
it 'does not redirect on out of bounds when non-html' do
get :index, params: params.merge(page: last_page + 1), format: 'atom'
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:issues).size).to eq(0)
expect(response).to have_gitlab_http_status(:redirect)
expect(response).to redirect_to(action: 'index', format: 'atom', page: last_page, state: 'opened')
end
it 'does not use pagination if disabled' 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