<commit_before>class ApplicationMailer < ActionMailer::Base
  INTERNAL_EMAIL = Rails.application.secrets[:internal_email].freeze

  default from: Rails.application.secrets[:from_email]
  layout "mailer"

  before_action :require_premailer
  before_action :add_images

  def self.should_send_internal_emails?
    INTERNAL_EMAIL.present?
  end

  private

  def add_image(image_path)
    path = Rails.root.join("app/assets/images/#{image_path}")
    image_file_name = File.basename(image_path)
    attachments.inline[image_file_name] = File.read(path)
  end

  def add_images
    add_image("mailer/brave-rewards.png")
    add_image("mailer/social_bat.png")
    add_image("mailer/social_reddit.png")
    add_image("mailer/social_brave.png")
    add_image("mailer/social_twitter.png")

    raise "Invalid mailer class; can't run #add_images." unless self.class == InternalMailer || self.class == PromoMailer || self.class == PublisherMailer
    
  end

  def require_premailer
    require "premailer/rails"
  end

  # TODO Find a better way to do this
  def should_add_share_images?
    if (@_action_name == "new_channel_registered_2018q1") || (@_action_name == "promo_activated_2018q1_verified")
      return true
    else
      return false
    end
  end

  def should_add_ad_banners?
    if @_action_name == "promo_activated_2018q1_verified"
      return true
    else
      return false
    end
  end
end
<commit_msg>chore: remove old code (#1550)<commit_after>class ApplicationMailer < ActionMailer::Base
  INTERNAL_EMAIL = Rails.application.secrets[:internal_email].freeze

  default from: Rails.application.secrets[:from_email]
  layout "mailer"

  before_action :require_premailer
  before_action :add_images

  def self.should_send_internal_emails?
    INTERNAL_EMAIL.present?
  end

  private

  def add_image(image_path)
    path = Rails.root.join("app/assets/images/#{image_path}")
    image_file_name = File.basename(image_path)
    attachments.inline[image_file_name] = File.read(path)
  end

  def add_images
    add_image("mailer/brave-rewards.png")
    add_image("mailer/social_bat.png")
    add_image("mailer/social_reddit.png")
    add_image("mailer/social_brave.png")
    add_image("mailer/social_twitter.png")

    raise "Invalid mailer class; can't run #add_images." unless self.class == InternalMailer || self.class == PromoMailer || self.class == PublisherMailer
    
  end

  def require_premailer
    require "premailer/rails"
  end
end

{'fraction_non_alphanumeric': 0.09760065067100447, 'fraction_numerical': 0.0077267181781211875, 'mean_word_length': 4.256410256410256, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5916155', 'n_tokens_mistral': 877, 'n_tokens_neox': 822, 'n_words': 150}