debian-mirror-gitlab/app/controllers/abuse_reports_controller.rb

29 lines
708 B
Ruby
Raw Normal View History

2015-09-11 14:41:01 +05:30
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
2015-10-24 18:46:33 +05:30
if current_application_settings.admin_notification_email.present?
AbuseReportMailer.delay.notify(@abuse_report.id)
end
2015-09-11 14:41:01 +05:30
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