@@ -108,6 +108,7 private | |||
|
108 | 108 | @query.name = params[:query] && params[:query][:name] |
|
109 | 109 | if User.current.allowed_to?(:manage_public_queries, @query.project) || User.current.admin? |
|
110 | 110 | @query.visibility = (params[:query] && params[:query][:visibility]) || IssueQuery::VISIBILITY_PRIVATE |
|
111 | @query.role_ids = params[:query] && params[:query][:role_ids] | |
|
111 | 112 | else |
|
112 | 113 | @query.visibility = IssueQuery::VISIBILITY_PRIVATE |
|
113 | 114 | end |
@@ -92,6 +92,22 class QueriesControllerTest < ActionController::TestCase | |||
|
92 | 92 | assert q.valid? |
|
93 | 93 | end |
|
94 | 94 | |
|
95 | def test_create_project_roles_query | |
|
96 | @request.session[:user_id] = 2 | |
|
97 | post :create, | |
|
98 | :project_id => 'ecookbook', | |
|
99 | :default_columns => '1', | |
|
100 | :fields => ["status_id", "assigned_to_id"], | |
|
101 | :operators => {"assigned_to_id" => "=", "status_id" => "o"}, | |
|
102 | :values => { "assigned_to_id" => ["1"], "status_id" => ["1"]}, | |
|
103 | :query => {"name" => "test_create_project_roles_query", "visibility" => "1", "role_ids" => ["1", "2", ""]} | |
|
104 | ||
|
105 | q = Query.find_by_name('test_create_project_roles_query') | |
|
106 | assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q | |
|
107 | assert_equal Query::VISIBILITY_ROLES, q.visibility | |
|
108 | assert_equal [1, 2], q.roles.ids.sort | |
|
109 | end | |
|
110 | ||
|
95 | 111 | def test_create_global_private_query_with_custom_columns |
|
96 | 112 | @request.session[:user_id] = 3 |
|
97 | 113 | post :create, |
General Comments 0
You need to be logged in to leave comments.
Login now