<commit_before>require 'kramdown'
class UserMailer < Devise::Mailer
  @@host = 'ices-recruiter-staging.com'
  default from: 'noreply@' + @@host

  def confirmation_instructions(user, token, opts={})
    send_from_db(user.email, Recruiter::Application.routes.url_helpers.user_confirmation_url(:confirmation_token => token, :host => @@host), 'confirm')
  end
  def reset_password_instructions(user, token, opts={})
    send_from_db(user.email, Recruiter::Application.routes.url_helpers.user_reset_url(:reset_token => token, :host => @@host), 'reset')
  end
  def unlock_instructions(user, token, opts={})
    send_from_db(user.email, Recruiter::Application.routes.url_helpers.user_unlock_url(:unlock_token => token, :host => @@host), 'unlock')
  end
  def send_from_db(email, url, template_name, opts = {})
    template = Email.find(template_name).value
    subject = Email.find(template_name).subject
    template.gsub!('@email', email)
    template.gsub!('@url', url) if url.present?
    headers = {
        :subject       => subject,
        :content_type => 'text/html',
        :to            => email,
        :body => Kramdown::Document.new(template).to_html.html_safe
    }.merge(opts)
    mail headers
  end
  def deactivation(user)
    send_from_db(user.email, nil, 'unlock')
  end
  def invite_to_register(email)
    send_from_db(email, nil, 'invite')<commit_msg>minor mail fix<commit_after>require 'kramdown'
class UserMailer < Devise::Mailer
  @@host = 'ices-recruiter-staging.herokuapp.com'
  default from: 'noreply@' + @@host

  def confirmation_instructions(user, token, opts={})
    send_from_db(user.email, Recruiter::Application.routes.url_helpers.user_confirmation_url(:confirmation_token => token, :host => @@host), 'confirm')
  end
  def reset_password_instructions(user, token, opts={})
    send_from_db(user.email, Recruiter::Application.routes.url_helpers.user_reset_url(:reset_token => token, :host => @@host), 'reset')
  end
  def unlock_instructions(user, token, opts={})
    send_from_db(user.email, Recruiter::Application.routes.url_helpers.user_unlock_url(:unlock_token => token, :host => @@host), 'unlock')
  end
  def send_from_db(email, url, template_name, opts = {})
    template = Email.find(template_name).value
    subject = Email.find(template_name).subject
    template.gsub!('@email', email)
    template.gsub!('@url', url) if url.present?
    headers = {
        :subject       => subject,
        :content_type => 'text/html',
        :to            => email,
        :body => Kramdown::Document.new(template).to_html.html_safe
    }.merge(opts)
    mail headers
  end
  def deactivation(user)
    send_from_db(user.email, 'http://' + @@host, 'unlock')
  end
  def invite_to_register(email)
    send_from_db(email, 'http://' + @@host, 'invite')
{'fraction_non_alphanumeric': 0.14757630161579893, 'fraction_numerical': 0.0, 'mean_word_length': 4.378378378378378, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '2980720', 'n_tokens_mistral': 938, 'n_tokens_neox': 928, 'n_words': 169}