From bbf173a019627b1f23f8d00eb1616e9a6979fe5c Mon Sep 17 00:00:00 2001 From: Pablo Brasero Date: Wed, 11 Mar 2026 18:34:29 +0000 Subject: [PATCH] Convert `UserMailer#follow_notification` to new style --- app/controllers/follows_controller.rb | 2 +- app/mailers/user_mailer.rb | 4 +++- test/mailers/previews/user_mailer_preview.rb | 2 +- test/mailers/user_mailer_test.rb | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/follows_controller.rb b/app/controllers/follows_controller.rb index d1603a604..479c288d9 100644 --- a/app/controllers/follows_controller.rb +++ b/app/controllers/follows_controller.rb @@ -28,7 +28,7 @@ class FollowsController < ApplicationController flash[:error] = t ".limit_exceeded" elsif follow.save flash[:notice] = t ".success", :name => @user.display_name - UserMailer.follow_notification(follow).deliver_later + UserMailer.with(:follow => follow).follow_notification.deliver_later else follow.add_error(t(".failed", :name => @user.display_name)) end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 012c3473a..abfadbd23 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -130,7 +130,9 @@ class UserMailer < ApplicationMailer end end - def follow_notification(follow) + def follow_notification + follow = params.fetch(:follow) + with_recipient_locale follow.following do @follow = follow @viewurl = user_url(@follow.follower) diff --git a/test/mailers/previews/user_mailer_preview.rb b/test/mailers/previews/user_mailer_preview.rb index 7e6578559..ebce04c72 100644 --- a/test/mailers/previews/user_mailer_preview.rb +++ b/test/mailers/previews/user_mailer_preview.rb @@ -69,7 +69,7 @@ class UserMailerPreview < ActionMailer::Preview def follow_notification following = create(:user, :languages => [I18n.locale]) follow = create(:follow, :following => following) - UserMailer.follow_notification(follow) + UserMailer.with(:follow => follow).follow_notification end def note_comment_notification diff --git a/test/mailers/user_mailer_test.rb b/test/mailers/user_mailer_test.rb index dc6126a06..a0de146d2 100644 --- a/test/mailers/user_mailer_test.rb +++ b/test/mailers/user_mailer_test.rb @@ -115,7 +115,7 @@ class UserMailerTest < ActionMailer::TestCase def test_follow_notification follow = create(:follow) - email = UserMailer.follow_notification(follow) + email = UserMailer.with(:follow => follow).follow_notification follower_profile_url = url_helpers.user_url(follow.follower) follow_follower_url = url_helpers.follow_url(follow.follower) -- 2.47.3