summaryrefslogtreecommitdiff
path: root/app/mailers
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2016-01-04 18:56:48 -0500
committerRobert Speicher <rspeicher@gmail.com>2016-01-04 18:59:25 -0500
commit01248d205103fe6c408e914e8943873ceb7acb2a (patch)
tree6f3e6e8b7abf80d0f67ee1fd98437a9b07053966 /app/mailers
parent0e60282e36faab8b0f4faee0b71716987df28416 (diff)
downloadgitlab-ce-01248d205103fe6c408e914e8943873ceb7acb2a.tar.gz
Make AbuseReportMailer responsible for knowing if it should deliver
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/abuse_report_mailer.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/mailers/abuse_report_mailer.rb b/app/mailers/abuse_report_mailer.rb
index f0c41f69a5c..d0ce827a595 100644
--- a/app/mailers/abuse_report_mailer.rb
+++ b/app/mailers/abuse_report_mailer.rb
@@ -2,11 +2,19 @@ class AbuseReportMailer < BaseMailer
include Gitlab::CurrentSettings
def notify(abuse_report_id)
+ return unless deliverable?
+
@abuse_report = AbuseReport.find(abuse_report_id)
mail(
- to: current_application_settings.admin_notification_email,
+ to: current_application_settings.admin_notification_email,
subject: "#{@abuse_report.user.name} (#{@abuse_report.user.username}) was reported for abuse"
)
end
+
+ private
+
+ def deliverable?
+ current_application_settings.admin_notification_email.present?
+ end
end