Skip to content

Commit

Permalink
Merge pull request #8144 from fjordllc/chore/add-return-date-and-reas…
Browse files Browse the repository at this point in the history
…on-to-suspension-notification

休会時のお知らせメール内に復帰予定日と理由を表示するようにした
  • Loading branch information
komagata authored Nov 28, 2024
2 parents 6dc5e67 + ad8a82b commit 5eaf190
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/mailers/activity_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:)
Expand Down
7 changes: 7 additions & 0 deletions app/views/activity_mailer/hibernated.html.slim
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 6 additions & 6 deletions test/mailers/activity_mailer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
)
Expand All @@ -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

Expand Down

0 comments on commit 5eaf190

Please sign in to comment.