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