summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblackst0ne <blackst0ne.ru@gmail.com>2018-04-09 19:16:40 +1100
committerblackst0ne <blackst0ne.ru@gmail.com>2018-04-09 19:16:40 +1100
commit58dd4a095fc44a5ed015618a833e1fb806fdf457 (patch)
treeb23f733ef274512a93e3a5f2a21a910e937ad91f
parentb8c098ecfa68f515ce76dba129c3f0ac3b3638b9 (diff)
downloadgitlab-ce-58dd4a095fc44a5ed015618a833e1fb806fdf457.tar.gz
Refactor `add_recipients`blackst0ne-rails5-fix-frozen-array
-rw-r--r--app/services/notification_recipient_service.rb5
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