mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: include topic excerpt in topic/message invite mail for existing user
This commit is contained in:
parent
5cc0d65f31
commit
d5db44da87
@ -79,10 +79,6 @@ class UserNotifications < ActionMailer::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_invited_to_private_message(user, opts)
|
|
||||||
notification_email(user, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
def user_replied(user, opts)
|
def user_replied(user, opts)
|
||||||
opts[:allow_reply_by_email] = true
|
opts[:allow_reply_by_email] = true
|
||||||
opts[:use_site_subject] = true
|
opts[:use_site_subject] = true
|
||||||
@ -124,7 +120,13 @@ class UserNotifications < ActionMailer::Base
|
|||||||
notification_email(user, opts)
|
notification_email(user, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def user_invited_to_private_message(user, opts)
|
||||||
|
opts[:use_template_html] = true
|
||||||
|
notification_email(user, opts)
|
||||||
|
end
|
||||||
|
|
||||||
def user_invited_to_topic(user, opts)
|
def user_invited_to_topic(user, opts)
|
||||||
|
opts[:use_template_html] = true
|
||||||
opts[:show_category_in_subject] = true
|
opts[:show_category_in_subject] = true
|
||||||
notification_email(user, opts)
|
notification_email(user, opts)
|
||||||
end
|
end
|
||||||
@ -193,6 +195,7 @@ class UserNotifications < ActionMailer::Base
|
|||||||
use_site_subject = opts[:use_site_subject]
|
use_site_subject = opts[:use_site_subject]
|
||||||
add_re_to_subject = opts[:add_re_to_subject]
|
add_re_to_subject = opts[:add_re_to_subject]
|
||||||
show_category_in_subject = opts[:show_category_in_subject]
|
show_category_in_subject = opts[:show_category_in_subject]
|
||||||
|
use_template_html = opts[:use_template_html]
|
||||||
original_username = @notification.data_hash[:original_username] || @notification.data_hash[:display_username]
|
original_username = @notification.data_hash[:original_username] || @notification.data_hash[:display_username]
|
||||||
|
|
||||||
send_notification_email(
|
send_notification_email(
|
||||||
@ -205,6 +208,7 @@ class UserNotifications < ActionMailer::Base
|
|||||||
add_re_to_subject: add_re_to_subject,
|
add_re_to_subject: add_re_to_subject,
|
||||||
show_category_in_subject: show_category_in_subject,
|
show_category_in_subject: show_category_in_subject,
|
||||||
notification_type: notification_type,
|
notification_type: notification_type,
|
||||||
|
use_template_html: use_template_html,
|
||||||
user: user
|
user: user
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -248,20 +252,26 @@ class UserNotifications < ActionMailer::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
html = UserNotificationRenderer.new(Rails.configuration.paths["app/views"]).render(
|
topic_excerpt = ""
|
||||||
template: 'email/notification',
|
if opts[:use_template_html]
|
||||||
format: :html,
|
topic_excerpt = post.excerpt.gsub("\n", " ") if post.is_first_post? && post.excerpt
|
||||||
locals: { context_posts: context_posts,
|
else
|
||||||
post: post,
|
html = UserNotificationRenderer.new(Rails.configuration.paths["app/views"]).render(
|
||||||
classes: RTL.new(user).css_class
|
template: 'email/notification',
|
||||||
}
|
format: :html,
|
||||||
)
|
locals: { context_posts: context_posts,
|
||||||
|
post: post,
|
||||||
|
classes: RTL.new(user).css_class
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
template = "user_notifications.user_#{notification_type}"
|
template = "user_notifications.user_#{notification_type}"
|
||||||
template << "_pm" if post.topic.private_message?
|
template << "_pm" if post.topic.private_message?
|
||||||
|
|
||||||
email_opts = {
|
email_opts = {
|
||||||
topic_title: title,
|
topic_title: title,
|
||||||
|
topic_excerpt: topic_excerpt,
|
||||||
message: email_post_markdown(post),
|
message: email_post_markdown(post),
|
||||||
url: post.url,
|
url: post.url,
|
||||||
post_id: post.id,
|
post_id: post.id,
|
||||||
@ -277,6 +287,8 @@ class UserNotifications < ActionMailer::Base
|
|||||||
include_respond_instructions: !user.suspended?,
|
include_respond_instructions: !user.suspended?,
|
||||||
template: template,
|
template: template,
|
||||||
html_override: html,
|
html_override: html,
|
||||||
|
site_description: SiteSetting.site_description,
|
||||||
|
site_title: SiteSetting.title,
|
||||||
style: :notification
|
style: :notification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1771,16 +1771,34 @@ en:
|
|||||||
user_invited_to_private_message_pm:
|
user_invited_to_private_message_pm:
|
||||||
subject_template: "[%{site_name}] %{username} invited you to a message '%{topic_title}'"
|
subject_template: "[%{site_name}] %{username} invited you to a message '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} invited you to a message '%{topic_title}' on %{site_name}:
|
|
||||||
|
|
||||||
Please visit this link to view the topic: %{base_url}%{url}
|
%{username} invited you to a message
|
||||||
|
|
||||||
|
> **%{topic_title}**
|
||||||
|
>
|
||||||
|
> %{topic_excerpt}
|
||||||
|
|
||||||
|
at
|
||||||
|
|
||||||
|
> %{site_title} -- %{site_description}
|
||||||
|
|
||||||
|
Please visit this link to view the message: %{base_url}%{url}
|
||||||
|
|
||||||
user_invited_to_topic:
|
user_invited_to_topic:
|
||||||
subject_template: "[%{site_name}] %{username} invited you to a topic '%{topic_title}'"
|
subject_template: "[%{site_name}] %{username} invited you to a topic '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} invited you to a topic '%{topic_title}' on %{site_name}:
|
|
||||||
|
|
||||||
Please visit this link to view the topic: %{base_url}%{url}
|
%{username} invited you to a discussion
|
||||||
|
|
||||||
|
> **%{topic_title}**
|
||||||
|
>
|
||||||
|
> %{topic_excerpt}
|
||||||
|
|
||||||
|
at
|
||||||
|
|
||||||
|
> %{site_title} -- %{site_description}
|
||||||
|
|
||||||
|
Please visit this link to view the message: %{base_url}%{url}
|
||||||
|
|
||||||
user_replied:
|
user_replied:
|
||||||
subject_template: "[%{site_name}] %{topic_title}"
|
subject_template: "[%{site_name}] %{topic_title}"
|
||||||
|
Loading…
Reference in New Issue
Block a user