Skip to content

Commit

Permalink
Merge pull request #13304 from krauselukas/refactor/return_early_find…
Browse files Browse the repository at this point in the history
…_for_event

Skip iteration in `FindForEvent#subscriptions` when there are no receivers for the role
  • Loading branch information
Dany Marcoux committed Nov 3, 2022
2 parents 8f34a7f + 838a3f6 commit 839b0d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/app/models/event_subscription/find_for_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def subscriptions(channel = :instant_email)
event.class.receiver_roles.each do |receiver_role|
# Find the users/groups who are receivers for this event
receivers = event.send("#{receiver_role}s")
next if receivers.blank?

receivers = expand_receivers(receivers, channel)

options = { eventtype: event.eventtype, receiver_role: receiver_role, channel: channel }
Expand Down

0 comments on commit 839b0d9

Please sign in to comment.