diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index a8dd3d83f..c5b819f47 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -538,7 +538,7 @@ private session[:query] = {:id => @query.id, :project_id => @query.project_id} sort_clear else - if params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) + if api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) # Give it a name, required to be valid @query = Query.new(:name => "_") @query.project = @project diff --git a/test/integration/issues_api_test.rb b/test/integration/issues_api_test.rb index 4406f3651..d107723f4 100644 --- a/test/integration/issues_api_test.rb +++ b/test/integration/issues_api_test.rb @@ -58,6 +58,15 @@ class IssuesApiTest < ActionController::IntegrationTest assert_response :success assert_equal 'application/xml', @response.content_type end + + def test_index_with_filter + get '/issues.xml?status_id=5' + assert_response :success + assert_equal 'application/xml', @response.content_type + assert_tag :tag => 'issues', + :children => { :count => Issue.visible.count(:conditions => {:status_id => 5}), + :only => { :tag => 'issue' } } + end def test_show_routing assert_routing(