Fix remote group visibility and use Mastodon's discoverable attribute

Make sure actor visibility is :public or :unlisted

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-08-11 18:00:35 +02:00
parent 7f0d29cfcc
commit c09deb5bc6
5 changed files with 117 additions and 82 deletions

View File

@@ -43,8 +43,15 @@ defmodule Mobilizon.Federation.ActivityPubTest do
describe "fetching actor from its url" do
test "returns an actor from nickname" do
use_cassette "activity_pub/fetch_tcit@framapiaf.org" do
assert {:ok, %Actor{preferred_username: "tcit", domain: "framapiaf.org"} = actor} =
ActivityPub.make_actor_from_nickname("tcit@framapiaf.org")
assert {:ok,
%Actor{preferred_username: "tcit", domain: "framapiaf.org", visibility: :public} =
actor} = ActivityPub.make_actor_from_nickname("tcit@framapiaf.org")
end
use_cassette "activity_pub/fetch_tcit@framapiaf.org_not_discoverable" do
assert {:ok,
%Actor{preferred_username: "tcit", domain: "framapiaf.org", visibility: :unlisted} =
actor} = ActivityPub.make_actor_from_nickname("tcit@framapiaf.org")
end
end
@@ -52,7 +59,9 @@ defmodule Mobilizon.Federation.ActivityPubTest do
test "returns an actor from url" do
# Initial fetch
use_cassette "activity_pub/fetch_framapiaf.org_users_tcit" do
assert {:ok, %Actor{preferred_username: "tcit", domain: "framapiaf.org"}} =
# Unlisted because discoverable is not present in the JSON payload
assert {:ok,
%Actor{preferred_username: "tcit", domain: "framapiaf.org", visibility: :unlisted}} =
ActivityPub.get_or_fetch_actor_by_url(@actor_url)
end

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long