diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-01-05 02:59:42 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-01-05 02:59:42 +0300 |
commit | 46a220ae3c0e646aac63a3230399fcc8979df6ec (patch) | |
tree | e58ef33e0afb682cc746220cdeebd0221173e93e /app | |
parent | 01248d205103fe6c408e914e8943873ceb7acb2a (diff) |
Add `AbuseReport#notify`
Tell, Don't Ask.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/abuse_reports_controller.rb | 4 | ||||
-rw-r--r-- | app/models/abuse_report.rb | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb index 5718fd22de9..38814459f66 100644 --- a/app/controllers/abuse_reports_controller.rb +++ b/app/controllers/abuse_reports_controller.rb @@ -9,9 +9,7 @@ class AbuseReportsController < ApplicationController @abuse_report.reporter = current_user if @abuse_report.save - if current_application_settings.admin_notification_email.present? - AbuseReportMailer.notify(@abuse_report.id).deliver_later - end + @abuse_report.notify message = "Thank you for your report. A GitLab administrator will look into it shortly." redirect_to @abuse_report.user, notice: message diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index 89b3116b9f2..55864236b2f 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -18,4 +18,10 @@ class AbuseReport < ActiveRecord::Base validates :user, presence: true validates :message, presence: true validates :user_id, uniqueness: true + + def notify + return unless self.persisted? + + AbuseReportMailer.notify(self.id).deliver_later + end end |