From a82c257d21f12ece50ea4d7675fbfd3f36e747bb Mon Sep 17 00:00:00 2001 From: Pablo Brasero Date: Thu, 12 Mar 2026 18:10:48 +0000 Subject: [PATCH] Convert `UserMailer#changeset_comment_notification` to new style --- app/controllers/api/changeset_comments_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/api/changeset_comments_controller.rb b/app/controllers/api/changeset_comments_controller.rb index a4ec6b3d8..4f67e9563 100644 --- a/app/controllers/api/changeset_comments_controller.rb +++ b/app/controllers/api/changeset_comments_controller.rb @@ -45,7 +45,7 @@ module Api # Notify current subscribers of the new comment changeset.subscribers.visible.each do |user| - UserMailer.changeset_comment_notification(comment, user).deliver_later if current_user != user + UserMailer.with(:comment => comment, :recipient => user).changeset_comment_notification.deliver_later if current_user != user end # Add the commenter to the subscribers if necessary diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 2ddd87779..7cfcea2b5 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -188,7 +188,9 @@ class UserMailer < ApplicationMailer end end - def changeset_comment_notification(comment, recipient) + def changeset_comment_notification + comment, recipient = params.fetch_values(:comment, :recipient) + with_recipient_locale recipient do @to_user = recipient.display_name @changeset_url = changeset_url(comment.changeset) diff --git a/test/mailers/previews/user_mailer_preview.rb b/test/mailers/previews/user_mailer_preview.rb index ed3a9dd59..b534a4636 100644 --- a/test/mailers/previews/user_mailer_preview.rb +++ b/test/mailers/previews/user_mailer_preview.rb @@ -82,6 +82,6 @@ class UserMailerPreview < ActionMailer::Preview def changeset_comment_notification recipient = create(:user, :languages => [I18n.locale]) comment = create(:changeset_comment) - UserMailer.changeset_comment_notification(comment, recipient) + UserMailer.with(:comment => comment, :recipient => recipient).changeset_comment_notification end end diff --git a/test/mailers/user_mailer_test.rb b/test/mailers/user_mailer_test.rb index 178011b14..62474b1d8 100644 --- a/test/mailers/user_mailer_test.rb +++ b/test/mailers/user_mailer_test.rb @@ -147,7 +147,7 @@ class UserMailerTest < ActionMailer::TestCase other_user = create(:user) changeset = create(:changeset, :user => user) changeset_comment = create(:changeset_comment, :changeset => changeset) - email = UserMailer.changeset_comment_notification(changeset_comment, other_user) + email = UserMailer.with(:comment => changeset_comment, :recipient => other_user).changeset_comment_notification body = parse_html_body(email) url = url_helpers.changeset_url(changeset) -- 2.39.5