Commit 9f6dc2a4 authored by Douwe Maan's avatar Douwe Maan

Only pass abuse report ID to AbuseReportMailer.

parent dc170516
...@@ -9,11 +9,12 @@ class AbuseReportsController < ApplicationController ...@@ -9,11 +9,12 @@ class AbuseReportsController < ApplicationController
@abuse_report.reporter = current_user @abuse_report.reporter = current_user
if @abuse_report.save if @abuse_report.save
message = "Thank you for your report. A GitLab administrator will look into it shortly."
redirect_to root_path, notice: message
if current_application_settings.admin_notification_email.present? if current_application_settings.admin_notification_email.present?
AbuseReportMailer.delay.notify(@abuse_report, current_application_settings.admin_notification_email) AbuseReportMailer.delay.notify(@abuse_report.id)
end end
message = "Thank you for your report. A GitLab administrator will look into it shortly."
redirect_to root_path, notice: message
else else
render :new render :new
end end
......
class AbuseReportMailer < BaseMailer class AbuseReportMailer < BaseMailer
include Gitlab::CurrentSettings
def notify(abuse_report, to_email) def notify(abuse_report_id)
@abuse_report = abuse_report @abuse_report = AbuseReport.find(abuse_report_id)
mail(to: to_email, subject: "[Gitlab] Abuse report filed for `#{@abuse_report.user.username}`") mail(
to: current_application_settings.admin_notification_email,
subject: "#{@abuse_report.user.name} (#{@abuse_report.user.username}) was reported for abuse"
)
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment