Merge pull request #5666 from LeoMcA/pm-subject-fix
FIX: error when group_in_subject enabled but no group in pm
This commit is contained in:
commit
ed08bc82f1
|
@ -435,13 +435,11 @@ class UserNotifications < ActionMailer::Base
|
||||||
|
|
||||||
if post.topic.private_message?
|
if post.topic.private_message?
|
||||||
subject_pm =
|
subject_pm =
|
||||||
if opts[:show_group_in_subject]
|
if opts[:show_group_in_subject] and group = post.topic.allowed_groups&.first
|
||||||
if group = post.topic.allowed_groups&.first
|
if group.full_name
|
||||||
if group.full_name
|
"[#{group.full_name}] "
|
||||||
"[#{group.full_name}] "
|
else
|
||||||
else
|
"[#{group.name}] "
|
||||||
"[#{group.name}] "
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
I18n.t('subject_pm')
|
I18n.t('subject_pm')
|
||||||
|
|
|
@ -467,6 +467,12 @@ describe UserNotifications do
|
||||||
|
|
||||||
include_examples "includes first group name"
|
include_examples "includes first group name"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "no groups in pm" do
|
||||||
|
it "includes %{optional_pm} in subject" do
|
||||||
|
expect(mail.subject).to include("[PM] ")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue