<commit_before># frozen_string_literal: true

class EmailNotificationMailer < ApplicationMailer
  add_template_helper AssetsHelper
  add_template_helper ImageHelper
  add_template_helper LocalHelper

  def followed_user(followed_user_id, user_id)
    @followed_user = User.only_kept.find(followed_user_id)
    @unsubscription_key = @followed_user.email_notification.unsubscription_key
    @user = User.only_kept.find(user_id)

    I18n.with_locale(@followed_user.locale) do
      subject = default_i18n_subject(
        name: @user.profile.name,
        username: @user.username
      )
      mail(to: @followed_user.email, subject: subject, &:mjml)
    end
  end

  def liked_episode_record(liked_user_id, user_id, episode_record_id)
    @liked_user = User.only_kept.find(liked_user_id)
    @unsubscription_key = @liked_user.email_notification.unsubscription_key
    @user = User.only_kept.find(user_id)
    @episode_record = @liked_user.episode_records.only_kept.find(episode_record_id)
    @work = @episode_record.work
    @episode = @episode_record.episode<commit_msg>ヘルパーの呼び方を修正<commit_after># frozen_string_literal: true

class EmailNotificationMailer < ApplicationMailer
  helper :assets
  helper :local
  helper "v4/image"

  def followed_user(followed_user_id, user_id)
    @followed_user = User.only_kept.find(followed_user_id)
    @unsubscription_key = @followed_user.email_notification.unsubscription_key
    @user = User.only_kept.find(user_id)

    I18n.with_locale(@followed_user.locale) do
      subject = default_i18n_subject(
        name: @user.profile.name,
        username: @user.username
      )
      mail(to: @followed_user.email, subject: subject, &:mjml)
    end
  end

  def liked_episode_record(liked_user_id, user_id, episode_record_id)
    @liked_user = User.only_kept.find(liked_user_id)
    @unsubscription_key = @liked_user.email_notification.unsubscription_key
    @user = User.only_kept.find(user_id)
    @episode_record = @liked_user.episode_records.only_kept.find(episode_record_id)
    @work = @episode_record.work
    @episode = @episode_record.episode
{'fraction_non_alphanumeric': 0.08747609942638623, 'fraction_numerical': 0.004302103250478011, 'mean_word_length': 4.781767955801105, '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': '4998332', 'n_tokens_mistral': 766, 'n_tokens_neox': 738, 'n_words': 103}