Can't set Email Notifications for Chat in admin setting

I just needed to set the default email notifications (to never) for chat for everyone, because it seems like when_away is the default.

I’m sharing the script:

User.all.each do |user|
  user_option = user.user_option

  if user_option.chat_email_frequency != "never"
    puts "User: #{user.username} - Current chat_email_frequency setting: #{user_option.chat_email_frequency}"
    user_option.update(chat_email_frequency: "never")
    # puts "Updated chat_email_frequency setting to 'never' for user: #{user.username}"
  end
end
1 Like