diff options
-rw-r--r-- | app/views/activities/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/versions/_sidebar.html.erb | 2 | ||||
-rw-r--r-- | test/functional/activities_controller_test.rb | 28 | ||||
-rw-r--r-- | test/functional/versions_controller_test.rb | 16 |
4 files changed, 46 insertions, 2 deletions
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index cb0bef9dc..e5176d859 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -50,7 +50,7 @@ </li> <% end %> </ul> -<% if @project && @project.descendants.active.any? %> +<% if @project && @project.descendants.visible.any? %> <%= hidden_field_tag 'with_subprojects', 0, :id => nil %> <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p> <% end %> diff --git a/app/views/versions/_sidebar.html.erb b/app/views/versions/_sidebar.html.erb index aecb7d131..0ce93fe82 100644 --- a/app/views/versions/_sidebar.html.erb +++ b/app/views/versions/_sidebar.html.erb @@ -20,7 +20,7 @@ <%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %> </label> </li> - <% if @project.descendants.active.any? %> + <% if @project.descendants.allowed_to(:view_issues).any? %> <li> <%= hidden_field_tag 'with_subprojects', 0, :id => nil %> <label> diff --git a/test/functional/activities_controller_test.rb b/test/functional/activities_controller_test.rb index 1d31ed1ff..7ab1948a4 100644 --- a/test/functional/activities_controller_test.rb +++ b/test/functional/activities_controller_test.rb @@ -45,6 +45,34 @@ class ActivitiesControllerTest < Redmine::ControllerTest assert_select 'dl dt.issue-edit a', :text => /(#{IssueStatus.find(2).name})/ end + def test_index_subproject_checkbox_should_check_descendants_visibility + @request.session[:user_id] = 2 + get( + :index, + :params => { + :id => 5, + } + ) + assert_response :success + + assert_select '#sidebar input#with_subprojects' + + project = Project.find(6) + project.is_public = false + project.save + + get( + :index, + :params => { + :id => 5, + } + ) + assert_response :success + + assert_select '#sidebar input#with_subprojects', :count => 0 + + end + def test_project_index_with_invalid_project_id_should_respond_404 get(:index, :params => {:id => 299}) assert_response 404 diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb index 86e218c1d..8a438ea4a 100644 --- a/test/functional/versions_controller_test.rb +++ b/test/functional/versions_controller_test.rb @@ -86,6 +86,8 @@ class VersionsControllerTest < Redmine::ControllerTest assert_select 'h3', :text => Version.find(4).name # Subproject version assert_select 'h3', :text => /#{version_name}/ + # Subproject checkbox + assert_select '#sidebar input[id=?][value=?]', "with_subprojects", 1 end def test_index_should_prepend_shared_versions @@ -118,6 +120,20 @@ class VersionsControllerTest < Redmine::ControllerTest end end + def test_index_subproject_checkbox_should_check_descendants_visibility + project = Project.find(6) + project.is_public = false + project.save + + @request.session[:user_id] = 2 + + get :index, :params => {:project_id => 5, :with_subprojects => 1} + assert_response :success + + # Subproject checkbox should not be shown + assert_select '#sidebar input[id=?]', "with_subprojects", :count => 0 + end + def test_show with_settings :gravatar_enabled => '0' do get :show, :params => {:id => 2} |