Commit 58dd4a09 authored by blackst0ne's avatar blackst0ne

Refactor `add_recipients`

parent b8c098ec
......@@ -51,11 +51,10 @@ module NotificationRecipientService
def add_recipients(users, type, reason)
if users.is_a?(ActiveRecord::Relation)
users = users.includes(:notification_settings).to_a
users = users.includes(:notification_settings)
end
users = Array(users)
users.compact!
users = Array(users).compact
recipients.concat(users.map { |u| make_recipient(u, type, reason) })
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment