mirror of
https://github.com/discourse/discourse.git
synced 2025-09-12 21:10:47 +08:00
FEATURE: add setting which adds group name to PM email subject (#5475)
This commit is contained in:
parent
b3b6373f77
commit
5d9d0fcb4f
5 changed files with 82 additions and 2 deletions
|
@ -258,6 +258,7 @@ class UserNotifications < ActionMailer::Base
|
|||
opts[:use_site_subject] = true
|
||||
opts[:add_re_to_subject] = true
|
||||
opts[:show_category_in_subject] = false
|
||||
opts[:show_group_in_subject] = true if SiteSetting.group_in_subject
|
||||
|
||||
# We use the 'user_posted' event when you are emailed a post in a PM.
|
||||
opts[:notification_type] = 'posted'
|
||||
|
@ -372,6 +373,7 @@ class UserNotifications < ActionMailer::Base
|
|||
use_site_subject: opts[:use_site_subject],
|
||||
add_re_to_subject: opts[:add_re_to_subject],
|
||||
show_category_in_subject: opts[:show_category_in_subject],
|
||||
show_group_in_subject: opts[:show_group_in_subject],
|
||||
notification_type: notification_type,
|
||||
use_invite_template: opts[:use_invite_template],
|
||||
user: user
|
||||
|
@ -422,6 +424,21 @@ class UserNotifications < ActionMailer::Base
|
|||
show_category_in_subject = nil
|
||||
end
|
||||
|
||||
if post.topic.private_message?
|
||||
subject_pm =
|
||||
if opts[:show_group_in_subject]
|
||||
if group = post.topic.allowed_groups&.first
|
||||
if group.full_name
|
||||
"[#{group.full_name}] "
|
||||
else
|
||||
"[#{group.name}] "
|
||||
end
|
||||
end
|
||||
else
|
||||
I18n.t('subject_pm')
|
||||
end
|
||||
end
|
||||
|
||||
if SiteSetting.private_email?
|
||||
title = I18n.t("system_messages.private_topic_title", id: post.topic_id)
|
||||
end
|
||||
|
@ -523,6 +540,7 @@ class UserNotifications < ActionMailer::Base
|
|||
add_re_to_subject: add_re_to_subject,
|
||||
show_category_in_subject: show_category_in_subject,
|
||||
private_reply: post.topic.private_message?,
|
||||
subject_pm: subject_pm,
|
||||
include_respond_instructions: !(user.suspended? || user.staged?),
|
||||
template: template,
|
||||
site_description: SiteSetting.site_description,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue