rework to use properties instead of compound typing, per SocialCG

This commit is contained in:
Ariadne Conill 2019-10-19 17:46:24 +00:00
parent 189a288925
commit c9280b9730
5 changed files with 7 additions and 11 deletions

View File

@ -1106,13 +1106,7 @@ defp object_to_user_data(data) do
locked = data["manuallyApprovesFollowers"] || false
data = Transmogrifier.maybe_fix_user_object(data)
discoverable = data["discoverable"] || false
invisible =
if is_list(data["type"]) do
Enum.member?(data["type"], "Invisible")
else
false
end
invisible = data["invisible"] || false
user_data = %{
ap_id: data["id"],

View File

@ -600,8 +600,7 @@ def handle_incoming(
"Person",
"Application",
"Service",
"Organization",
["Application", "Invisible"]
"Organization"
] do
with %User{ap_id: ^actor_id} = actor <- User.get_cached_by_ap_id(object["id"]) do
{:ok, new_user_data} = ActivityPub.user_data_from_user_object(object)

View File

@ -55,7 +55,8 @@ def render("service.json", %{user: user}) do
"owner" => user.ap_id,
"publicKeyPem" => public_key
},
"endpoints" => endpoints
"endpoints" => endpoints,
"invisible" => User.invisible?(user)
}
|> Map.merge(Utils.make_json_ld_header())
end

View File

@ -19,6 +19,7 @@
"value": "schema:value",
"sensitive": "as:sensitive",
"litepub": "http://litepub.social/ns#",
"invisible": "litepub:invisible",
"directMessage": "litepub:directMessage",
"listMessage": {
"@id": "litepub:listMessage",

View File

@ -12,7 +12,8 @@
"Emoji": "toot:Emoji"
}],
"id": "http://mastodon.example.org/users/admin",
"type": ["Application", "Invisible"],
"type": "Application",
"invisible": true,
"following": "http://mastodon.example.org/users/admin/following",
"followers": "http://mastodon.example.org/users/admin/followers",
"inbox": "http://mastodon.example.org/users/admin/inbox",