From a8072b0d0f201754cfc6f0867b642fdb43af6054 Mon Sep 17 00:00:00 2001
From: Go MAEDA
+ <%= l(:label_user) %> + <%= select_tag('user_id', activity_authors_options_for_select(@project, params[:user_id]), include_blank: true) %> +
<%= submit_tag l(:button_apply), :class => 'button-small', :name => 'submit' %>
<% end %> <% end %> diff --git a/test/functional/activities_controller_test.rb b/test/functional/activities_controller_test.rb index dbbe33b48..cab6c34bb 100644 --- a/test/functional/activities_controller_test.rb +++ b/test/functional/activities_controller_test.rb @@ -87,6 +87,7 @@ class ActivitiesControllerTest < Redmine::ControllerTest assert_response :success assert_select 'h2 a[href="/users/2"]', :text => 'John Smith' + assert_select '#sidebar select#user_id option[value="2"][selected=selected]' i1 = Issue.find(1) d1 = User.find(1).time_to_date(i1.created_on) diff --git a/test/helpers/activities_helper_test.rb b/test/helpers/activities_helper_test.rb index 714eab14a..8f86aca9a 100644 --- a/test/helpers/activities_helper_test.rb +++ b/test/helpers/activities_helper_test.rb @@ -109,4 +109,24 @@ class ActivitiesHelperTest < Redmine::HelperTest sort_activity_events(events).map {|event, grouped| [event.name, grouped]} ) end + + def test_activity_authors_options_for_select_if_current_user_is_admin + User.current = User.find(1) + project = Project.find(1) + + options = [["<< #{l(:label_me)} >>", 1], ['Dave Lopper', 3], ['John Smith', 2], ['Redmine Admin', 1], ['User Misc', 8]] + assert_equal( + options_for_select(options, nil), + activity_authors_options_for_select(project, nil)) + end + + def test_activity_authors_options_for_select_if_current_user_is_anonymous + User.current = nil + project = Project.find(1) + + options = [['Dave Lopper', 3], ['John Smith', 2]] + assert_equal( + options_for_select(options, nil), + activity_authors_options_for_select(project, nil)) + end end -- 2.39.5