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} session[:query] = {:id => @query.id, :project_id => @query.project_id}
sort_clear sort_clear
else 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 # Give it a name, required to be valid
@query = Query.new(:name => "_") @query = Query.new(:name => "_")
@query.project = @project @query.project = @project

View File

@ -58,6 +58,15 @@ class IssuesApiTest < ActionController::IntegrationTest
assert_response :success assert_response :success
assert_equal 'application/xml', @response.content_type assert_equal 'application/xml', @response.content_type
end 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 def test_show_routing
assert_routing( assert_routing(