2015-09-11 14:41:01 +05:30
|
|
|
class AbuseReportsController < ApplicationController
|
|
|
|
def new
|
|
|
|
@abuse_report = AbuseReport.new
|
|
|
|
@abuse_report.user_id = params[:user_id]
|
2016-01-19 16:12:03 +05:30
|
|
|
@ref_url = params.fetch(:ref_url, '')
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@abuse_report = AbuseReport.new(report_params)
|
|
|
|
@abuse_report.reporter = current_user
|
|
|
|
|
|
|
|
if @abuse_report.save
|
2016-01-14 18:37:52 +05:30
|
|
|
@abuse_report.notify
|
2015-10-24 18:46:33 +05:30
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
message = "Thank you for your report. A GitLab administrator will look into it shortly."
|
2016-01-14 18:37:52 +05:30
|
|
|
redirect_to @abuse_report.user, notice: message
|
2015-09-11 14:41:01 +05:30
|
|
|
else
|
|
|
|
render :new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def report_params
|
2016-01-14 18:37:52 +05:30
|
|
|
params.require(:abuse_report).permit(%i(
|
|
|
|
message
|
|
|
|
user_id
|
|
|
|
))
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|