<commit_before>class SimpleMailer < ActionMailer::Base
  default :from => "<NAME> <<EMAIL>>"
  include ApplicationHelper
  helper :application
  layout 'mailer'

  # Notifications via emails:
  # We send notifications based on a user's preferences, and based on the status
  # of the previous build.
  def post_build_email_hook(build)
    # common to all emails
    @build = build
    @project = @build.project
    @last_build = @build.parent_build

    @logs = @build.logs
    @last_log = @logs.last
    @successful_logs = @logs.find_all { |l| l.success? }

    users = @project.users.find_all { |u| !u.is_guest? }

    # User specific emails, like "welcome"
    users.each { |u| self.maybe_send_first_email u }

    # Emails for the build, like "pass" and "fail"
    send_build_email users
  end

  def send_build_email(users)
    status = @build.status
    subject = @build.as_email_subject
    cc = []
    cc << "<EMAIL>" if status == :infrastructure_fail
    bcc = ["<EMAIL>"]

    to = users.find_all { |u| u.wants_build_email?(@build) }.map {|u| u.email }
    return if to == [] && cc == []

    # TODO: stop doing this "visible" hack
    if Rails.env.production? && !@project.visible
      to = ["<EMAIL>"]
    end

    if status == :infrastructure_fail
      to = ["<EMAIL>"]
    end<commit_msg>Send email to everyone, not just "visible" people.<commit_after>class SimpleMailer < ActionMailer::Base
  default :from => "<NAME> <<EMAIL>>"
  include ApplicationHelper
  helper :application
  layout 'mailer'

  # Notifications via emails:
  # We send notifications based on a user's preferences, and based on the status
  # of the previous build.
  def post_build_email_hook(build)
    # common to all emails
    @build = build
    @project = @build.project
    @last_build = @build.parent_build

    @logs = @build.logs
    @last_log = @logs.last
    @successful_logs = @logs.find_all { |l| l.success? }

    users = @project.users.find_all { |u| !u.is_guest? }

    # User specific emails, like "welcome"
    users.each { |u| self.maybe_send_first_email u }

    # Emails for the build, like "pass" and "fail"
    send_build_email users
  end

  def send_build_email(users)
    status = @build.status
    subject = @build.as_email_subject
    cc = []
    cc << "<EMAIL>" if status == :infrastructure_fail
    bcc = ["<EMAIL>"]

    to = users.find_all { |u| u.wants_build_email?(@build) }.map {|u| u.email }
    return if to == [] && cc == []

    if status == :infrastructure_fail
      to = ["<EMAIL>"]
    end
{'fraction_non_alphanumeric': 0.12738095238095237, 'fraction_numerical': 0.0, 'mean_word_length': 3.1463815789473686, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3801170', 'n_tokens_mistral': 855, 'n_tokens_neox': 834, 'n_words': 234}