Merge branch 'omit-nondiscoverable-from-search' into 'develop'

User search should respect discoverable flag

See merge request pleroma/pleroma!2997
This commit is contained in:
Haelwenn 2020-09-17 17:59:38 +00:00
commit beefc022dd
9 changed files with 56 additions and 24 deletions

View file

@ -177,5 +177,14 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
assert total == 3
assert count == 1
end
test "it returns non-discoverable users" do
insert(:user)
insert(:user, discoverable: false)
{:ok, _results, total} = Search.user()
assert total == 2
end
end
end

View file

@ -68,7 +68,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
sensitive: false,
pleroma: %{
actor_type: "Person",
discoverable: false
discoverable: true
},
fields: []
},
@ -166,7 +166,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
sensitive: false,
pleroma: %{
actor_type: "Service",
discoverable: false
discoverable: true
},
fields: []
},

View file

@ -16,7 +16,7 @@ defmodule Pleroma.Web.MetadataTest do
end
test "for local user" do
user = insert(:user)
user = insert(:user, discoverable: false)
assert Pleroma.Web.Metadata.build_tags(%{user: user}) =~
"<meta content=\"noindex, noarchive\" name=\"robots\">"
@ -40,7 +40,7 @@ defmodule Pleroma.Web.MetadataTest do
test "search exclusion metadata is included" do
clear_config([:instance, :public], false)
user = insert(:user, bio: "This is my secret fedi account bio")
user = insert(:user, bio: "This is my secret fedi account bio", discoverable: false)
assert ~s(<meta content="noindex, noarchive" name="robots">) ==
Pleroma.Web.Metadata.build_tags(%{user: user})