diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-06 14:03:27 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-06 14:03:27 +0200 |
commit | cba7f20dc8614d12e3eeda6e14f454aeb22b9b54 (patch) | |
tree | f4c13a141c07a8baa0bf404b33ade6cfbd4c4f0e /app/controllers/abuse_reports_controller.rb | |
parent | ce47dd4bb0c686aee13b309b07eb8f976aa5d547 (diff) | |
download | gitlab-ce-cba7f20dc8614d12e3eeda6e14f454aeb22b9b54.tar.gz |
Allow users to send abuse reports
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/abuse_reports_controller.rb')
-rw-r--r-- | app/controllers/abuse_reports_controller.rb | 23 |
1 files changed, 23 insertions, 0 deletions
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 |