search: Apply following filter only when user is usable
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Wed, 2 Sep 2020 18:11:24 +0000 (20:11 +0200)
committerrinpatch <rinpatch@sdf.org>
Tue, 8 Sep 2020 17:21:34 +0000 (20:21 +0300)
lib/pleroma/user/search.ex

index adbef7fb8c45abf7ca989d57f4f4c1bdf1593f6e..7babd47ea542db084a171d373c2b1bc84aaac836 100644 (file)
@@ -115,8 +115,8 @@ defmodule Pleroma.User.Search do
     )
   end
 
-  defp base_query(_user, false), do: User
-  defp base_query(user, true), do: User.get_friends_query(user)
+  defp base_query(%User{} = user, true), do: User.get_friends_query(user)
+  defp base_query(_user, _following), do: User
 
   defp filter_invisible_users(query) do
     from(q in query, where: q.invisible == false)