Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-06-29 16:23:09 +0300
committerDouwe Maan <douwe@gitlab.com>2017-06-29 16:23:09 +0300
commit0f5e70a8246de623ddafdc17c5d9ea5cb866b21a (patch)
treeacae90f5a578e30d18a782da60304f3d22b28e32 /app
parent8c5538be40b527ad8b5e3468730b84416ec536c1 (diff)
parent49957cf55114d75dc2c1e62c71a98aad98866960 (diff)
Merge branch 'hb-fix-abuse-report-on-stale-user-profile' into 'master'
Fix errors caused by attempts to report already blocked or deleted users Closes #8928 See merge request !12502
Diffstat (limited to 'app')
-rw-r--r--app/controllers/abuse_reports_controller.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb
index 2eac0cabf7a..ed13ead63f9 100644
--- a/app/controllers/abuse_reports_controller.rb
+++ b/app/controllers/abuse_reports_controller.rb
@@ -1,7 +1,9 @@
class AbuseReportsController < ApplicationController
+ before_action :set_user, only: [:new]
+
def new
@abuse_report = AbuseReport.new
- @abuse_report.user_id = params[:user_id]
+ @abuse_report.user_id = @user.id
@ref_url = params.fetch(:ref_url, '')
end
@@ -27,4 +29,14 @@ class AbuseReportsController < ApplicationController
user_id
))
end
+
+ def set_user
+ @user = User.find_by(id: params[:user_id])
+
+ if @user.nil?
+ redirect_to root_path, alert: "Cannot create the abuse report. The user has been deleted."
+ elsif @user.blocked?
+ redirect_to @user, alert: "Cannot create the abuse report. This user has been blocked."
+ end
+ end
end