From c596d7df777d94dc071c8d1582644df2eb41f108 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 16 Oct 2019 12:50:30 +0530 Subject: [PATCH] FIX: respect private_email setting for user invited notification email --- app/mailers/user_notifications.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index e74c94e8e27..bdf9c856987 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -558,7 +558,12 @@ class UserNotifications < ActionMailer::Base end topic_excerpt = post.excerpt.tr("\n", " ") if post.is_first_post? && post.excerpt - topic_excerpt = "" if SiteSetting.private_email? + topic_url = post.topic&.url + + if SiteSetting.private_email? + topic_excerpt = "" + topic_url = "" + end message = I18n.t(invite_template, username: username, @@ -567,7 +572,7 @@ class UserNotifications < ActionMailer::Base topic_excerpt: topic_excerpt, site_title: SiteSetting.title, site_description: SiteSetting.site_description, - topic_url: post.topic.url + topic_url: topic_url ) html = PrettyText.cook(message, sanitize: false).html_safe