From 8395da5bd0619e43a2e8786fb6d631ae703884dc Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 10 Jul 2014 10:03:09 +0530 Subject: [PATCH] FIX: include topic title and domain name in topic invite mail --- app/mailers/invite_mailer.rb | 1 + config/locales/server.en.yml | 2 +- spec/mailers/invite_mailer_spec.rb | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/mailers/invite_mailer.rb b/app/mailers/invite_mailer.rb index c5c4d3bf1fc..daf01ec0c75 100644 --- a/app/mailers/invite_mailer.rb +++ b/app/mailers/invite_mailer.rb @@ -24,6 +24,7 @@ class InviteMailer < ActionMailer::Base build_email(invite.email, template: 'invite_mailer', invitee_name: invitee_name, + site_domain_name: Discourse.current_hostname, invite_link: "#{Discourse.base_url}/invites/#{invite.invite_key}", topic_title: first_topic.try(:title), topic_excerpt: topic_excerpt, diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 4b4cb07dcdc..a33f9b5a4e5 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1048,7 +1048,7 @@ en: blocked: "is blocked." invite_mailer: - subject_template: "%{invitee_name} invited you to a discussion at %{site_name}" + subject_template: "%{invitee_name} invited you to '%{topic_title}' on %{site_domain_name}" text_body_template: | %{invitee_name} invited you to a discussion diff --git a/spec/mailers/invite_mailer_spec.rb b/spec/mailers/invite_mailer_spec.rb index 5c1e90fc7ee..6c0fa6d0e97 100644 --- a/spec/mailers/invite_mailer_spec.rb +++ b/spec/mailers/invite_mailer_spec.rb @@ -42,6 +42,14 @@ describe InviteMailer do expect(invite_mail.subject).to be_present end + it 'renders topic title in subject' do + expect(invite_mail.subject).to match(topic.title) + 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