diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2018-04-09 11:16:40 +0300 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2018-04-09 11:16:40 +0300 |
commit | 58dd4a095fc44a5ed015618a833e1fb806fdf457 (patch) | |
tree | b23f733ef274512a93e3a5f2a21a910e937ad91f /app | |
parent | b8c098ecfa68f515ce76dba129c3f0ac3b3638b9 (diff) |
Refactor `add_recipients`
Diffstat (limited to 'app')
-rw-r--r-- | app/services/notification_recipient_service.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb index ed070cfaa54..b82d9c64296 100644 --- a/app/services/notification_recipient_service.rb +++ b/app/services/notification_recipient_service.rb @@ -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 |