Skip to content

Commit

Permalink
Make sure NULL users don't crash the email
Browse files Browse the repository at this point in the history
  • Loading branch information
xhero committed Jan 20, 2021
1 parent cdb4d11 commit 6bc66b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/mailers/comment_notifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def new_comment(comment)
users.compact.uniq! # Users can be duplicated
users -= [comment.author_id] # Don't send the comment to myself!

addresses = users.each.map do |u|
addresses = users.compact.each.map do |u|
next if u == 0 # Don't send to user 0 (autogenerated items during import)
next if u == 1 # Don't sent to admin
email = User.find(u).email
Expand Down

0 comments on commit 6bc66b9

Please sign in to comment.