Merge pull request #2524 from techAPJ/patch-3

Improve invite email copy
This commit is contained in:
Jeff Atwood 2014-07-09 22:47:23 -07:00
commit 4654bb3688
3 changed files with 13 additions and 8 deletions

View File

@ -7,14 +7,14 @@ class InviteMailer < ActionMailer::Base
# Find the first topic they were invited to
first_topic = invite.topics.order(:created_at).first
# get invitee name (based on site setting)
invitee_name = invite.invited_by.username
if (SiteSetting.enable_names)
invitee_name = "#{invite.invited_by.name} (#{invite.invited_by.username})"
end
# If they were invited to a topic
if first_topic.present?
# get invitee name (based on site setting)
invitee_name = invite.invited_by.username
if (SiteSetting.enable_names)
invitee_name = "#{invite.invited_by.name} (#{invite.invited_by.username})"
end
# get topic excerpt
topic_excerpt = ""
if first_topic.excerpt
@ -33,7 +33,8 @@ class InviteMailer < ActionMailer::Base
else
build_email(invite.email,
template: 'invite_forum_mailer',
invitee_name: invite.invited_by.username,
invitee_name: invitee_name,
site_domain_name: Discourse.current_hostname,
invite_link: "#{Discourse.base_url}/invites/#{invite.invite_key}",
site_description: SiteSetting.site_description,
site_title: SiteSetting.title)

View File

@ -1067,7 +1067,7 @@ en:
This invitation is from a trusted user, so you can reply to the discussion immediately.
invite_forum_mailer:
subject_template: "%{invitee_name} invited you to join %{site_name}"
subject_template: "%{invitee_name} invited you to join %{site_domain_name}"
text_body_template: |
%{invitee_name} invited you to join

View File

@ -16,6 +16,10 @@ describe InviteMailer do
expect(invite_mail.subject).to be_present
end
it 'renders site domain name in subject' do
expect(invite_mail.subject).to match(Discourse.current_hostname)
end
it 'renders the body' do
expect(invite_mail.body).to be_present
end