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
|
||||
|
||||
def user_invited_to_private_message(user, opts)
|
||||
notification_email(user, opts)
|
||||
end
|
||||
|
||||
def user_replied(user, opts)
|
||||
opts[:allow_reply_by_email] = true
|
||||
opts[:use_site_subject] = true
|
||||
|
@ -124,7 +120,13 @@ class UserNotifications < ActionMailer::Base
|
|||
notification_email(user, opts)
|
||||
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)
|
||||
opts[:use_template_html] = true
|
||||
opts[:show_category_in_subject] = true
|
||||
notification_email(user, opts)
|
||||
end
|
||||
|
@ -193,6 +195,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]
|
||||
use_template_html = opts[:use_template_html]
|
||||
original_username = @notification.data_hash[:original_username] || @notification.data_hash[:display_username]
|
||||
|
||||
send_notification_email(
|
||||
|
@ -205,6 +208,7 @@ class UserNotifications < ActionMailer::Base
|
|||
add_re_to_subject: add_re_to_subject,
|
||||
show_category_in_subject: show_category_in_subject,
|
||||
notification_type: notification_type,
|
||||
use_template_html: use_template_html,
|
||||
user: user
|
||||
)
|
||||
|
||||
|
@ -248,20 +252,26 @@ class UserNotifications < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
|
||||
html = UserNotificationRenderer.new(Rails.configuration.paths["app/views"]).render(
|
||||
template: 'email/notification',
|
||||
format: :html,
|
||||
locals: { context_posts: context_posts,
|
||||
post: post,
|
||||
classes: RTL.new(user).css_class
|
||||
}
|
||||
)
|
||||
topic_excerpt = ""
|
||||
if opts[:use_template_html]
|
||||
topic_excerpt = post.excerpt.gsub("\n", " ") if post.is_first_post? && post.excerpt
|
||||
else
|
||||
html = UserNotificationRenderer.new(Rails.configuration.paths["app/views"]).render(
|
||||
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 << "_pm" if post.topic.private_message?
|
||||
|
||||
email_opts = {
|
||||
topic_title: title,
|
||||
topic_excerpt: topic_excerpt,
|
||||
message: email_post_markdown(post),
|
||||
url: post.url,
|
||||
post_id: post.id,
|
||||
|
@ -277,6 +287,8 @@ class UserNotifications < ActionMailer::Base
|
|||
include_respond_instructions: !user.suspended?,
|
||||
template: template,
|
||||
html_override: html,
|
||||
site_description: SiteSetting.site_description,
|
||||
site_title: SiteSetting.title,
|
||||
style: :notification
|
||||
}
|
||||
|
||||
|
|
|
@ -1771,16 +1771,34 @@ en:
|
|||
user_invited_to_private_message_pm:
|
||||
subject_template: "[%{site_name}] %{username} invited you to a message '%{topic_title}'"
|
||||
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:
|
||||
subject_template: "[%{site_name}] %{username} invited you to a topic '%{topic_title}'"
|
||||
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:
|
||||
subject_template: "[%{site_name}] %{topic_title}"
|
||||
|
|
Loading…
Reference in New Issue