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
[#60018] Ensure reminders are included in notifications eager loading wrapper
Kabiru Mwenja7116350bf824
diff --git a/lib/api/v3/notifications/notification_eager_loading_wrapper.rb b/lib/api/v3/notifications/notification_eager_loading_wrapper.rbindex 55ce073a95c..509e5776b7f 100644--- a/lib/api/v3/notifications/notification_eager_loading_wrapper.rb+++ b/lib/api/v3/notifications/notification_eager_loading_wrapper.rb@@ -35,23 +35,6 @@ module APInotifications.includes(API::V3::Notifications::NotificationRepresenter.to_eager_load).to_a- .tap { |loaded_notifications| set_resource(loaded_notifications) }- end-- private-- # The resource cannot be loaded by rails eager loading means (include)- # because it is a polymorphic association. That being as it is, currently only- # work packages are assigned.- def set_resource(notifications)- work_packages_by_id = WorkPackage- .includes(:project)- .where(id: notifications.pluck(:resource_id).uniq)- .index_by(&:id)-- notifications.each do |notification|- notification.resource = work_packages_by_id[notification.resource_id]- endendendenddiff --git a/lib/api/v3/notifications/notification_representer.rb b/lib/api/v3/notifications/notification_representer.rbindex 6984fe23518..dfc90493b3c 100644--- a/lib/api/v3/notifications/notification_representer.rb+++ b/lib/api/v3/notifications/notification_representer.rb@@ -104,7 +104,7 @@ module API"Notification"end- self.to_eager_load = %i[actor journal reminder]+ self.to_eager_load = [:actor, :journal, :reminder, { resource: :project }]endendend