mirror of
https://github.com/redmine/redmine.git
synced 2025-11-07 22:05:56 +01:00
Default query should not be applied if the query is not allowed to be set as the default (#37499).
Patch by Mizuki ISHIKAWA. git-svn-id: https://svn.redmine.org/redmine/trunk@21748 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -274,6 +274,39 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
end
|
||||
|
||||
def test_index_should_ignore_user_default_query_if_it_is_invisible
|
||||
query = ProjectQuery.find(11)
|
||||
|
||||
query.update(visibility: Query::VISIBILITY_PRIVATE, user_id: 2)
|
||||
query.save!
|
||||
|
||||
# If visible default query
|
||||
@request.session[:user_id] = 2
|
||||
User.find(2).pref.update(default_project_query: query.id)
|
||||
get :index
|
||||
assert_select 'h2', text: query.name
|
||||
|
||||
# If invisible default query
|
||||
@request.session[:user_id] = 3
|
||||
User.find(3).pref.update(default_project_query: query.id)
|
||||
get :index
|
||||
assert_select 'h2', text: I18n.t(:label_project_plural)
|
||||
end
|
||||
|
||||
def test_index_should_ignore_global_default_query_if_it_is_not_public
|
||||
query = ProjectQuery.find(11)
|
||||
with_settings default_project_query: query.id do
|
||||
query.update(visibility: Query::VISIBILITY_PRIVATE, user_id: 2)
|
||||
query.save!
|
||||
|
||||
[User.find(1), User.find(2)].each do |user|
|
||||
@request.session[:user_id] = user.id
|
||||
get :index
|
||||
assert_select 'h2', text: I18n.t(:label_project_plural)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_autocomplete_js
|
||||
get(
|
||||
:autocomplete,
|
||||
|
||||
Reference in New Issue
Block a user