GitLab steht Mittwoch, den 23. September, zwischen 10:00 und 12:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 7f06014e authored by jplang's avatar jplang

Wrong filters are applied when exporting issues to CSV with blank filter (#23206).

Patch by Go MAEDA.

git-svn-id: https://svn.redmine.org/redmine/trunk@15608 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 19d5b10e
...@@ -257,6 +257,8 @@ module QueriesHelper ...@@ -257,6 +257,8 @@ module QueriesHelper
tags << hidden_field_tag("v[#{field}][]", value, :id => nil) tags << hidden_field_tag("v[#{field}][]", value, :id => nil)
end end
end end
else
tags << hidden_field_tag("f[]", "", :id => nil)
end end
if query.column_names.present? if query.column_names.present?
query.column_names.each do |name| query.column_names.each do |name|
......
...@@ -488,6 +488,9 @@ class IssuesControllerTest < ActionController::TestCase ...@@ -488,6 +488,9 @@ class IssuesControllerTest < ActionController::TestCase
assert_select 'input[name=?][value=?]', 'sort', 'status' assert_select 'input[name=?][value=?]', 'sort', 'status'
end end
get :index, :project_id => 1, :set_filter => "1", :f => []
assert_select '#csv-export-form input[name=?][value=?]', 'f[]', ''
end end
def test_index_csv def test_index_csv
...@@ -507,6 +510,14 @@ class IssuesControllerTest < ActionController::TestCase ...@@ -507,6 +510,14 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'text/csv; header=present', @response.content_type assert_equal 'text/csv; header=present', @response.content_type
end end
def test_index_csv_without_any_filters
@request.session[:user_id] = 1
Issue.create!(:project_id => 1, :tracker_id => 1, :status_id => 5, :subject => 'Closed issue', :author_id => 1)
get :index, :set_filter => 1, :f => [], :format => 'csv'
assert_response :success
assert_equal Issue.count, assigns(:issues).count
end
def test_index_csv_with_description def test_index_csv_with_description
Issue.generate!(:description => 'test_index_csv_with_description') Issue.generate!(:description => 'test_index_csv_with_description')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment