Defect #35789 » 0002-Don-t-throw-a-404-error-on-activities-index-with-a-n.patch
| app/controllers/activities_controller.rb | ||
|---|---|---|
| 33 | 33 |
@date_from = @date_to - @days |
| 34 | 34 |
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') |
| 35 | 35 |
if params[:user_id].present? |
| 36 |
@author = User.visible.active.find(params[:user_id]) |
|
| 36 |
begin |
|
| 37 |
visible_and_active_user = User.visible.active.find(params[:user_id]) |
|
| 38 |
rescue ActiveRecord::RecordNotFound |
|
| 39 |
@author = nil |
|
| 40 |
else |
|
| 41 |
@author = visible_and_active_user |
|
| 42 |
end |
|
| 37 | 43 |
end |
| 38 | 44 | |
| 39 | 45 |
@activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, |
| test/functional/activities_controller_test.rb | ||
|---|---|---|
| 107 | 107 |
assert_response 404 |
| 108 | 108 |
end |
| 109 | 109 | |
| 110 |
def test_user_index_with_non_visible_user_id_should_respond_404
|
|
| 110 |
def test_user_index_with_non_visible_user_id_should_respond_without_processing_user_id_param
|
|
| 111 | 111 |
Role.anonymous.update! :users_visibility => 'members_of_visible_projects' |
| 112 | 112 |
user = User.generate! |
| 113 | 113 | |
| ... | ... | |
| 115 | 115 |
get :index, :params => {
|
| 116 | 116 |
:user_id => user.id |
| 117 | 117 |
} |
| 118 |
assert_response 404 |
|
| 118 |
assert_response :success |
|
| 119 | ||
| 120 |
assert_select 'h2', :text => "Activity", :count => 1 |
|
| 121 |
assert_select "h2 a:match('href', ?)", /\/users\//, {:text => "Bob Doe", :count => 0}, "Not visible user link element and/or link text present"
|
|
| 119 | 122 |
end |
| 120 | 123 | |
| 121 | 124 |
def test_index_atom_feed |