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

@@ -39,6 +39,9 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
"sc" => "http://schema.org#",
"ical" => "http://www.w3.org/2002/12/cal/ical#",
"pt" => "https://joinpeertube.org/ns#",
"toot" => "http://joinmastodon.org/ns#",
"discoverable" => "toot:discoverable",
"manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
"Hashtag" => "as:Hashtag",
"category" => "sc:category",
"uuid" => "sc:identifier",

View File

@@ -64,7 +64,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
shared_inbox_url: data["endpoints"]["sharedInbox"],
domain: URI.parse(data["id"]).host,
manually_approves_followers: data["manuallyApprovesFollowers"],
type: data["type"]
type: data["type"],
visibility: if(Map.get(data, "discoverable", false) == true, do: :public, else: :unlisted)
}
end
@@ -96,6 +97,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
"endpoints" => %{
"sharedInbox" => actor.shared_inbox_url
},
"discoverable" => actor.visibility == :public,
"manuallyApprovesFollowers" => actor.manually_approves_followers,
"publicKey" => %{
"id" => "#{actor.url}#main-key",