Fix unlisted groups being available in search
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -35,14 +35,19 @@ defmodule Mobilizon.GraphQL.API.SearchTest do
|
||||
|
||||
test "search actors" do
|
||||
with_mock Actors,
|
||||
build_actors_by_username_or_name_page: fn %{term: "toto"}, _type, 1, 10 ->
|
||||
build_actors_by_username_or_name_page: fn "toto", _options, 1, 10 ->
|
||||
%Page{total: 1, elements: [%Actor{id: 42}]}
|
||||
end do
|
||||
assert {:ok, %{total: 1, elements: [%Actor{id: 42}]}} =
|
||||
Search.search_actors(%{term: "toto"}, 1, 10, :Person)
|
||||
|
||||
assert_called(
|
||||
Actors.build_actors_by_username_or_name_page(%{term: "toto"}, [:Person], 1, 10)
|
||||
Actors.build_actors_by_username_or_name_page(
|
||||
"toto",
|
||||
[actor_type: [:Person], radius: nil, location: nil, minimum_visibility: :public],
|
||||
1,
|
||||
10
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -188,7 +188,10 @@ defmodule Mobilizon.ActorsTest do
|
||||
with {:ok, %Actor{id: actor2_id}} <-
|
||||
ActivityPub.get_or_fetch_actor_by_url(@remote_account_url) do
|
||||
%Page{total: 2, elements: actors} =
|
||||
Actors.build_actors_by_username_or_name_page(%{term: "tcit"}, [:Person])
|
||||
Actors.build_actors_by_username_or_name_page("tcit",
|
||||
actor_type: [:Person],
|
||||
minimum_visibility: :private
|
||||
)
|
||||
|
||||
actors_ids = actors |> Enum.map(& &1.id)
|
||||
|
||||
@@ -199,7 +202,7 @@ defmodule Mobilizon.ActorsTest do
|
||||
|
||||
test "test build_actors_by_username_or_name_page/4 returns actors with similar names" do
|
||||
%{total: 0, elements: actors} =
|
||||
Actors.build_actors_by_username_or_name_page(%{term: "ohno"}, [:Person])
|
||||
Actors.build_actors_by_username_or_name_page("ohno", actor_type: [:Person])
|
||||
|
||||
assert actors == []
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user