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

31 lines
666 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]
@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
@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."
redirect_to @abuse_report.user, notice: message
2015-09-11 14:41:01 +05:30
else
render :new
end
end
private
def report_params
params.require(:abuse_report).permit(%i(
message
user_id
))
2015-09-11 14:41:01 +05:30
end
end