Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

休会時のお知らせメール内に復帰予定日と理由を表示するようにした #8144

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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