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

Avoid N+1 for emoji reaction reactable reads

Kabiru Mwenjae450cca5bbb8
diff --git a/app/models/concerns/reactable.rb b/app/models/concerns/reactable.rb
index 5f2392dbcf1..51bdcfaaaa1 100644
--- a/app/models/concerns/reactable.rb
+++ b/app/models/concerns/reactable.rb
@@ -56,6 +56,7 @@ module Reactable
EmojiReaction
.select(emoji_reactions_group_selection_sql)
.joins(:user)
+ .includes(:reactable)
.where(reactable_id:, reactable_type:)
.group("emoji_reactions.reactable_type, emoji_reactions.reactable_id, emoji_reactions.reaction")
.order("first_created_at ASC")