From d4c89bccfc96b0d342cf5165cc890646fafc8196 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 29 Jun 2017 13:09:33 -0700 Subject: [PATCH] potential fix for #3189 --- app/models/post_flag.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/post_flag.rb b/app/models/post_flag.rb index 1e93cc32f..93b0304c3 100644 --- a/app/models/post_flag.rb +++ b/app/models/post_flag.rb @@ -79,8 +79,10 @@ class PostFlag < ApplicationRecord if params[:creator_name].present? flagger_id = User.name_to_id(params[:creator_name].strip) - if CurrentUser.can_view_flagger?(flagger_id) + if flagger_id && CurrentUser.can_view_flagger?(flagger_id) q = q.where("creator_id = ?", flagger_id) + else + q = q.where("false") end end