OSDN Git Service

Accept filters from API calls without set_filter parameter.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 18 Jan 2010 19:53:06 +0000 (19:53 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 18 Jan 2010 19:53:06 +0000 (19:53 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3335 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
test/integration/issues_api_test.rb

index a8dd3d8..c5b819f 100644 (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
index 4406f36..d107723 100644 (file)
@@ -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(