<commit_before>class UserMailer < ActionMailer::Base
  def common(user)
    @recipients = user.email_address
    @from       = "no-reply@#{ ActionMailer::Base.default_url_options[:host] }"
    @sent_on    = Time.now
    @headers    = {}
  end

  def question_title(answer)
    answer.question.try.title || "none"
  end

  def forgot_password(user, key)
    common(user)
    @subject    = "#{@app_name} -- forgotten password"
    @body       = { :user => user, :key => key, :app_name => app_name }
  end

  def new_question(user, question)
    common(user)
    @subject    = "New question"
    @body       = { :title=> question.title, :category => question.question_category,
      :id => question.id}
  end

  def new_answer(user, answer)
    common(user)
    @subject    = "New answer"
    @body       = { :question_title=> question_title(answer), :recruit_name =>
      answer.owner.name, :id => answer.id}
  end

  def changed_answer(user, answer)
    common(user)
    @subject    = "Changed answer"
    @body       = { :question_title=> question_title(answer), :recruit_name =>
      answer.owner.name, :id => answer.id}
  end

  def new_comment(user, comment)
    common(user)
    @subject    = "New comment"
    @body       = { :question_title=> question_title(comment.answer), :id => comment.answer.id }
  end
end<commit_msg>Set email title in UserMailer#common<commit_after>class UserMailer < ActionMailer::Base
  def common(user, subject)
    @recipients = user.email_address
    @from       = "no-reply@#{ ActionMailer::Base.default_url_options[:host] }"
    @sent_on    = Time.now
    @headers    = {}
    @subject    = subject
  end

  def question_title(answer)
    answer.question.try.title || "none"
  end

  def forgot_password(user, key)
    common(user, "#{@app_name} -- forgotten password")
    @body = { :user => user, :key => key, :app_name => app_name }
  end

  def new_question(user, question)
    common(user, "New question")
    @body = { :title=> question.title, :category => question.question_category,
      :id => question.id}
  end

  def new_answer(user, answer)
    common(user, "New answer")
    @body = { :question_title=> question_title(answer), :recruit_name =>
      answer.owner.name, :id => answer.id}
  end

  def changed_answer(user, answer)
    common(user, "Changed answer")
    @body = { :question_title=> question_title(answer), :recruit_name =>
      answer.owner.name, :id => answer.id}
  end

  def new_comment(user, comment)
    common(user, "New comment")
    @body = { :question_title=> question_title(comment.answer), :id => comment.answer.id }
  end
end
{'fraction_non_alphanumeric': 0.13924050632911392, 'fraction_numerical': 0.0, 'mean_word_length': 3.2132471728594507, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '5362923', 'n_tokens_mistral': 865, 'n_tokens_neox': 852, 'n_words': 189}