|> base_query(following)
|> filter_blocked_user(for_user)
|> filter_invisible_users()
- |> filter_discoverable_users()
+ |> filter_non_discoverable_users()
|> filter_internal_users()
|> filter_blocked_domains(for_user)
|> fts_search(query_string)
from(q in query, where: q.invisible == false)
end
- defp filter_discoverable_users(query) do
- from(q in query, where: q.discoverable == true)
+ defp filter_non_discoverable_users(query) do
+ # Note: commented out — can't do it with users being non-discoverable by default
+ # from(q in query, where: q.is_discoverable == true)
+ query
end
defp filter_internal_users(query) do
assert found_user.id == user.id
end
- test "excludes users when discoverable is false" do
+ test "does NOT exclude non-discoverable users from results (as long as it's the default)" do
+ # NOTE: as long as users are non-discoverable by default, we can't filter out most users: #2301
insert(:user, %{nickname: "john 3000", discoverable: false})
insert(:user, %{nickname: "john 3001"})
users = User.search("john")
- assert Enum.count(users) == 1
+ assert Enum.count(users) == 2
end
test "excludes service actors from results" do