Files
gitlabhq/app/controllers/abuse_reports_controller.rb
Robert SpeicherandRobert Speicher 955f424834 Merge branch 'jrochkind/gitlab-ce-fix_2839_send_abuse_report_notify' into 'master'
Send an email to admin email when a user is reported for spam

Replaces !1547.

Fixes #2839.

See merge request !1634
2015-10-19 14:07:34 +02:00

29 lines
708 B
Ruby

class AbuseReportsController < ApplicationController
def new
@abuse_report = AbuseReport.new
@abuse_report.user_id = params[:user_id]
end
def create
@abuse_report = AbuseReport.new(report_params)
@abuse_report.reporter = current_user
if @abuse_report.save
if current_application_settings.admin_notification_email.present?
AbuseReportMailer.delay.notify(@abuse_report.id)
end
message = "Thank you for your report. A GitLab administrator will look into it shortly."
redirect_to root_path, notice: message
else
render :new
end
end
private
def report_params
params.require(:abuse_report).permit(:user_id, :message)
end
end