mirror of
https://github.com/discourse/discourse.git
synced 2026-08-13 06:25:11 -05:00
FIX: Do not show recipient user in email participants list (#14642)
This commit removes the recipient's username from the respond to / participants list that is shown at the bottom of user notification emails. For example if the recipient's username was jsmith, and there were participants ljones and bmiller, we currently show this: > "reply to this email to respond to jsmith, ljones, bmiller" or > "Participants: jsmith, ljones, bmiller" However this is a bit redundant, as you are not replying to yourself here if you are the recipient user. So we omit the recipient user's username from this list, which is only used in the text of the email and not elsewhere.
This commit is contained in:
@@ -9,6 +9,7 @@ class GroupSmtpMailer < ActionMailer::Base
|
||||
raise 'SMTP is disabled' if !SiteSetting.enable_smtp
|
||||
|
||||
op_incoming_email = post.topic.first_post.incoming_email
|
||||
recipient_user = User.find_by_email(to_address, primary: true)
|
||||
|
||||
delivery_options = {
|
||||
address: from_group.smtp_server,
|
||||
@@ -39,7 +40,7 @@ class GroupSmtpMailer < ActionMailer::Base
|
||||
only_reply_by_email: true,
|
||||
use_from_address_for_reply_to: SiteSetting.enable_smtp && from_group.smtp_enabled?,
|
||||
private_reply: post.topic.private_message?,
|
||||
participants: participants(post),
|
||||
participants: participants(post, recipient_user),
|
||||
include_respond_instructions: true,
|
||||
template: 'user_notifications.user_posted_pm',
|
||||
use_topic_title_subject: true,
|
||||
@@ -72,7 +73,7 @@ class GroupSmtpMailer < ActionMailer::Base
|
||||
)
|
||||
end
|
||||
|
||||
def participants(post)
|
||||
def participants(post, recipient_user)
|
||||
list = []
|
||||
|
||||
post.topic.allowed_groups.each do |g|
|
||||
@@ -80,6 +81,8 @@ class GroupSmtpMailer < ActionMailer::Base
|
||||
end
|
||||
|
||||
post.topic.allowed_users.each do |u|
|
||||
next if u.id == recipient_user.id
|
||||
|
||||
if SiteSetting.prioritize_username_in_ux?
|
||||
if u.staged?
|
||||
list.push("#{u.email}")
|
||||
|
||||
@@ -560,6 +560,8 @@ class UserNotifications < ActionMailer::Base
|
||||
end
|
||||
|
||||
post.topic.allowed_users.each do |u|
|
||||
next if u.id == user.id
|
||||
|
||||
if SiteSetting.prioritize_username_in_ux?
|
||||
participant_list.push "[#{u.username}](#{Discourse.base_url}/u/#{u.username_lower})"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user