Skip to content

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

fix[Op#40437]: Safely parse last updated at timestamp

Kabiru Mwenja2a0b25f9bb0b
diff --git a/app/controllers/work_packages/activities_tab_controller.rb b/app/controllers/work_packages/activities_tab_controller.rb
index 0865eb8f3f5..16f3a55b25a 100644
--- a/app/controllers/work_packages/activities_tab_controller.rb
+++ b/app/controllers/work_packages/activities_tab_controller.rb
@@ -49,12 +49,7 @@ class WorkPackages::ActivitiesTabController < ApplicationController
end
def update_streams
- if params[:last_update_timestamp].present?
- generate_time_based_update_streams(params[:last_update_timestamp])
- generate_time_based_reaction_update_streams(params[:last_update_timestamp])
- else
- @turbo_status = :bad_request
- end
+ perform_update_streams_from_last_update_timestamp
respond_with_turbo_streams
end
@@ -254,8 +249,16 @@ class WorkPackages::ActivitiesTabController < ApplicationController
if call.result.initial?
update_index_component # update the whole index component to reset empty state
else
- generate_time_based_update_streams(params[:last_update_timestamp])
- generate_time_based_reaction_update_streams(params[:last_update_timestamp])
+ perform_update_streams_from_last_update_timestamp
+ end
+ end
+
+ def perform_update_streams_from_last_update_timestamp
+ if params[:last_update_timestamp].present? && (last_updated_at = Time.zone.parse(params[:last_update_timestamp]))
+ generate_time_based_update_streams(last_updated_at)
+ generate_time_based_reaction_update_streams(last_updated_at)
+ else
+ @turbo_status = :bad_request
end
end