<commit_before>class ThreadMailer < ActionMailer::Base
  include MailerHelper
  default from: Rails.application.config.default_email_from

  def new_message(message, subscriber)
    common(message, subscriber)
  end

  def new_photo_message(message, subscriber)
    # attachments['photo.jpg'] = message.component.photo_medium.data
    common(message, subscriber)
  end

  def new_deadline_message(message, subscriber)
    common(message, subscriber)
  end

  def new_link_message(message, subscriber)
    common(message, subscriber)
  end

  def new_library_item_message(message, subscriber)
    common(message, subscriber)
  end

  def new_document_message(message, subscriber)
    common(message, subscriber)
  end

  protected

  def common(message, subscriber)
    @message = message
    @thread = message.thread
    @subscriber = subscriber
    email_from = user_notification_address(message.created_by)
    reply_to = thread_address(@thread)
    mail(to: subscriber.name_with_email,
         subject: t("mailers.thread_mailer.common.subject", title: @thread.title, count: @thread.message_count),
         from: email_from,
         reply_to: reply_to)
  end
end
<commit_msg>Patch to possibly add threading headers to cyclestreets mails<commit_after>class ThreadMailer < ActionMailer::Base
  include MailerHelper
  default from: Rails.application.config.default_email_from

  def new_message(message, subscriber)
    common(message, subscriber)
  end

  def new_photo_message(message, subscriber)
    # attachments['photo.jpg'] = message.component.photo_medium.data
    common(message, subscriber)
  end

  def new_deadline_message(message, subscriber)
    common(message, subscriber)
  end

  def new_link_message(message, subscriber)
    common(message, subscriber)
  end

  def new_library_item_message(message, subscriber)
    common(message, subscriber)
  end

  def new_document_message(message, subscriber)
    common(message, subscriber)
  end

  protected

  def common(message, subscriber)
    @message = message
    @thread = message.thread
    @subscriber = subscriber
    email_from = user_notification_address(message.created_by)
    reply_to = thread_address(@thread)
    mail(to: subscriber.name_with_email,
         subject: t("mailers.thread_mailer.common.subject", title: @thread.title, count: @thread.message_count),
         from: email_from,
         references: reply_to,
         reply_to: reply_to)
  end
end

{'fraction_non_alphanumeric': 0.08200082000820008, 'fraction_numerical': 0.0, 'mean_word_length': 4.350877192982456, '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': '2333362', 'n_tokens_mistral': 750, 'n_tokens_neox': 700, 'n_words': 158}