diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 482721e68..0c70dfc9d 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1984,6 +1984,8 @@ en: header_instructions: '' reply_by_email: "[Visit Topic](%{base_url}%{url}) or reply to this email to respond" visit_link_to_respond: "[Visit Topic](%{base_url}%{url}) to respond" + reply_by_email_pm: "[Visit Message](%{base_url}%{url}) or reply to this email to respond" + visit_link_to_respond_pm: "[Visit Message](%{base_url}%{url}) to respond" posted_by: "Posted by %{username} on %{post_date}" diff --git a/lib/email/message_builder.rb b/lib/email/message_builder.rb index 28b38f9fa..76754654c 100644 --- a/lib/email/message_builder.rb +++ b/lib/email/message_builder.rb @@ -34,9 +34,9 @@ module Email @template_args[:respond_instructions] = '' else @template_args[:respond_instructions] = if allow_reply_by_email? - I18n.t('user_notifications.reply_by_email', @template_args) + @opts[:private_reply] ? I18n.t('user_notifications.reply_by_email_pm', @template_args) : I18n.t('user_notifications.reply_by_email', @template_args) else - I18n.t('user_notifications.visit_link_to_respond', @template_args) + @opts[:private_reply] ? I18n.t('user_notifications.visit_link_to_respond_pm', @template_args) : I18n.t('user_notifications.visit_link_to_respond', @template_args) end end end diff --git a/spec/components/email/message_builder_spec.rb b/spec/components/email/message_builder_spec.rb index 8ff2dc511..05a4abd92 100644 --- a/spec/components/email/message_builder_spec.rb +++ b/spec/components/email/message_builder_spec.rb @@ -194,7 +194,7 @@ describe Email::MessageBuilder do end it "does not add unsubscribe via email link without site setting set" do - expect(message_with_unsubscribe_via_email.body).to_not match(/mailto:reply@#{Discourse.current_hostname}\?subject=unsubscribe/) + expect(message_with_unsubscribe_via_email.body).to_not match(/mailto:reply@#{Discourse.current_hostname}\?subject=unsubscribe/) end end diff --git a/spec/mailers/user_notifications_spec.rb b/spec/mailers/user_notifications_spec.rb index 5cb260787..393484954 100644 --- a/spec/mailers/user_notifications_spec.rb +++ b/spec/mailers/user_notifications_spec.rb @@ -111,6 +111,9 @@ describe UserNotifications do # subject should include category name expect(mail.subject).to match(/India/) + # 2 "visit topic" link + expect(mail.html_part.to_s.scan(/Visit Topic/).count).to eq(2) + # 2 respond to links cause we have 1 context post expect(mail.html_part.to_s.scan(/to respond/).count).to eq(2) @@ -181,6 +184,9 @@ describe UserNotifications do # subject should include "[PM]" expect(mail.subject).to match("[PM]") + # 1 "visit message" link + expect(mail.html_part.to_s.scan(/Visit Message/).count).to eq(1) + # 1 respond to link expect(mail.html_part.to_s.scan(/to respond/).count).to eq(1)