From cba7f20dc8614d12e3eeda6e14f454aeb22b9b54 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 6 Aug 2015 14:03:27 +0200 Subject: Allow users to send abuse reports Signed-off-by: Dmitriy Zaporozhets --- app/controllers/abuse_reports_controller.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/controllers/abuse_reports_controller.rb (limited to 'app/controllers/abuse_reports_controller.rb') diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb new file mode 100644 index 00000000000..757be5ef727 --- /dev/null +++ b/app/controllers/abuse_reports_controller.rb @@ -0,0 +1,23 @@ +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 + redirect_to root_path, notice: 'Thank you for report. GitLab administrator will be able to see it' + else + render :new + end + end + + private + + def report_params + params.require(:abuse_report).permit(:user_id, :message) + end +end -- cgit v1.2.3