Accept filters from API calls without set_filter parameter.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3335 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2010-01-18 19:53:06 +00:00
parent 320c191f04
commit 1bc00ac022
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -59,6 +59,15 @@ class IssuesApiTest < ActionController::IntegrationTest
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(
{:method => :get, :path => '/issues/1.xml'},