summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-18 19:53:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-18 19:53:06 +0000
commit1bc00ac022e4bf6efe1a90167cec2a83c6be998b (patch)
tree8b55277dfd9f3967242d82b9396b359d3b45121d
parent320c191f04d84bbf9e1f97a8c93d87719a7a27c6 (diff)
downloadredmine-1bc00ac022e4bf6efe1a90167cec2a83c6be998b.tar.gz
redmine-1bc00ac022e4bf6efe1a90167cec2a83c6be998b.zip
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
-rw-r--r--app/controllers/issues_controller.rb2
-rw-r--r--test/integration/issues_api_test.rb9
2 files changed, 10 insertions, 1 deletions
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(