From ad8a82bd4411f3dcd714ab17a8739fa7172f5344 Mon Sep 17 00:00:00 2001 From: ryo Date: Tue, 22 Oct 2024 13:54:10 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BC=91=E4=BC=9A=E6=99=82=E3=81=AE=E3=81=8A?= =?UTF-8?q?=E7=9F=A5=E3=82=89=E3=81=9B=E3=83=A1=E3=83=BC=E3=83=AB=E5=86=85?= =?UTF-8?q?=E3=81=AB=E5=BE=A9=E5=B8=B0=E4=BA=88=E5=AE=9A=E6=97=A5=E3=81=A8?= =?UTF-8?q?=E7=90=86=E7=94=B1=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/mailers/activity_mailer.rb | 1 + app/views/activity_mailer/hibernated.html.slim | 7 +++++++ test/mailers/activity_mailer_test.rb | 12 ++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/mailers/activity_mailer.rb b/app/mailers/activity_mailer.rb index 4790e4e0f0a..177d811f730 100644 --- a/app/mailers/activity_mailer.rb +++ b/app/mailers/activity_mailer.rb @@ -287,6 +287,7 @@ def hibernated(args = {}) link: "/users/#{@sender.id}", kind: Notification.kinds[:hibernated] ) + @hibernation = Hibernation.find_by(user_id: @sender.id) subject = "[FBC] #{@sender.login_name}さんが休会しました。" message = mail(to: @user.email, subject:) diff --git a/app/views/activity_mailer/hibernated.html.slim b/app/views/activity_mailer/hibernated.html.slim index ff607cf258c..2b461eb4ed2 100644 --- a/app/views/activity_mailer/hibernated.html.slim +++ b/app/views/activity_mailer/hibernated.html.slim @@ -1,3 +1,10 @@ = render '/notification_mailer/notification_mailer_template', title: "#{@sender.login_name}さんが休会しました。", link_url: @link_url, link_text: "#{@sender.login_name}さんのページへ" do + .a-long-text + h2 + = Hibernation.human_attribute_name('scheduled_return_on') + = @hibernation.scheduled_return_on + h2 + = Hibernation.human_attribute_name('reason') + = md2html(@hibernation.reason) diff --git a/test/mailers/activity_mailer_test.rb b/test/mailers/activity_mailer_test.rb index c50821c5494..5539bfa2eb2 100644 --- a/test/mailers/activity_mailer_test.rb +++ b/test/mailers/activity_mailer_test.rb @@ -721,13 +721,13 @@ class ActivityMailerTest < ActionMailer::TestCase end test 'hibernated using synchronous mailer' do - user = users(:kimura) + user = users(:kyuukai) mentor = users(:komagata) Notification.create!( kind: 19, sender: user, user: mentor, - message: 'kimuraさんが休会しました。', + message: 'kyuukaiさんが休会しました。', link: "/users/#{user.id}", read: false ) @@ -740,18 +740,18 @@ class ActivityMailerTest < ActionMailer::TestCase email = ActionMailer::Base.deliveries.last assert_equal ['noreply@bootcamp.fjord.jp'], email.from assert_equal ['komagata@fjord.jp'], email.to - assert_equal '[FBC] kimuraさんが休会しました。', email.subject + assert_equal '[FBC] kyuukaiさんが休会しました。', email.subject assert_match(/休会/, email.body.to_s) end test 'hibernated with params using asynchronous mailer' do - user = users(:kimura) + user = users(:kyuukai) mentor = users(:komagata) Notification.create!( kind: 19, sender: user, user: mentor, - message: 'kimuraさんが休会しました。', + message: 'kyuukaiさんが休会しました。', link: "/users/#{user.id}", read: false ) @@ -768,7 +768,7 @@ class ActivityMailerTest < ActionMailer::TestCase email = ActionMailer::Base.deliveries.last assert_equal ['noreply@bootcamp.fjord.jp'], email.from assert_equal ['komagata@fjord.jp'], email.to - assert_equal '[FBC] kimuraさんが休会しました。', email.subject + assert_equal '[FBC] kyuukaiさんが休会しました。', email.subject assert_match(/休会/, email.body.to_s) end