OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#57664] Fix error when viewing inactive user activity.
Pavel Balashoue7a482de17f4
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rbindex 930caf24843..14a9af48b6b 100644--- a/app/controllers/activities_controller.rb+++ b/app/controllers/activities_controller.rb@@ -45,20 +45,18 @@ class ActivitiesController < ApplicationControlleraccept_key_auth :index+ rescue_from ActiveRecord::RecordNotFound do |exception|+ op_handle_warning "Failed to find all resources in activities: #{exception.message}"+ render_404(message: I18n.t(:error_can_not_find_all_resources))+ end+def index@events = @activity.events(from: @date_from.to_datetime, to: @date_to.to_datetime)respond_to do |format|- format.html do- respond_html- end- format.atom do- respond_atom- end+ format.html { respond_html }+ format.atom { respond_atom }end- rescue ActiveRecord::RecordNotFound => e- op_handle_warning "Failed to find all resources in activities: #{e.message}"- render_404 I18n.t(:error_can_not_find_all_resources)enddef menudiff --git a/spec/controllers/activities_controller_spec.rb b/spec/controllers/activities_controller_spec.rbindex f180975dd12..b4fae82124b 100644--- a/spec/controllers/activities_controller_spec.rb+++ b/spec/controllers/activities_controller_spec.rb@@ -88,6 +88,16 @@ RSpec.describe ActivitiesController doexpect(response).to have_http_status(:not_found)endend++ describe "inactive user activity" do+ let!(:inactive_user) { create(:user, status: User.statuses[:locked]) }++ it "renders 404" do+ get "index", params: { user_id: inactive_user.id }+ expect(response).to have_http_status(:not_found)+ expect(response).to render_template "common/error"+ end+ endenddescribe "with activated activity module" do