summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-09-12 10:54:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-09-12 10:54:45 +0000
commit2a15166f9be9856108a86d2dcdd678dea38bfa46 (patch)
tree6ca182c0b1b225549984cd46cb76d1839502c237
parent1e026442f15caa0b3ee18fee630852656226d190 (diff)
downloadredmine-2a15166f9be9856108a86d2dcdd678dea38bfa46.tar.gz
redmine-2a15166f9be9856108a86d2dcdd678dea38bfa46.zip
Merged r14472 (#20427).
git-svn-id: http://svn.redmine.org/redmine/branches/3.1-stable@14546 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/queries_controller.rb1
-rw-r--r--test/functional/queries_controller_test.rb16
2 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb
index e09790b94..72c09de64 100644
--- a/app/controllers/queries_controller.rb
+++ b/app/controllers/queries_controller.rb
@@ -108,6 +108,7 @@ private
@query.name = params[:query] && params[:query][:name]
if User.current.allowed_to?(:manage_public_queries, @query.project) || User.current.admin?
@query.visibility = (params[:query] && params[:query][:visibility]) || IssueQuery::VISIBILITY_PRIVATE
+ @query.role_ids = params[:query] && params[:query][:role_ids]
else
@query.visibility = IssueQuery::VISIBILITY_PRIVATE
end
diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb
index dd93de4bf..68dac7aa3 100644
--- a/test/functional/queries_controller_test.rb
+++ b/test/functional/queries_controller_test.rb
@@ -92,6 +92,22 @@ class QueriesControllerTest < ActionController::TestCase
assert q.valid?
end
+ def test_create_project_roles_query
+ @request.session[:user_id] = 2
+ post :create,
+ :project_id => 'ecookbook',
+ :default_columns => '1',
+ :fields => ["status_id", "assigned_to_id"],
+ :operators => {"assigned_to_id" => "=", "status_id" => "o"},
+ :values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
+ :query => {"name" => "test_create_project_roles_query", "visibility" => "1", "role_ids" => ["1", "2", ""]}
+
+ q = Query.find_by_name('test_create_project_roles_query')
+ assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
+ assert_equal Query::VISIBILITY_ROLES, q.visibility
+ assert_equal [1, 2], q.roles.ids.sort
+ end
+
def test_create_global_private_query_with_custom_columns
@request.session[:user_id] = 3
post :create,