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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
locked = data["manuallyApprovesFollowers"] || false locked = data["manuallyApprovesFollowers"] || false
data = Transmogrifier.maybe_fix_user_object(data) data = Transmogrifier.maybe_fix_user_object(data)
discoverable = data["discoverable"] || false discoverable = data["discoverable"] || false
invisible = data["invisible"] || false
invisible =
if is_list(data["type"]) do
Enum.member?(data["type"], "Invisible")
else
false
end
user_data = %{ user_data = %{
ap_id: data["id"], ap_id: data["id"],

View File

@ -600,8 +600,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
"Person", "Person",
"Application", "Application",
"Service", "Service",
"Organization", "Organization"
["Application", "Invisible"]
] do ] do
with %User{ap_id: ^actor_id} = actor <- User.get_cached_by_ap_id(object["id"]) 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) {:ok, new_user_data} = ActivityPub.user_data_from_user_object(object)

View File

@ -55,7 +55,8 @@ defmodule Pleroma.Web.ActivityPub.UserView do
"owner" => user.ap_id, "owner" => user.ap_id,
"publicKeyPem" => public_key "publicKeyPem" => public_key
}, },
"endpoints" => endpoints "endpoints" => endpoints,
"invisible" => User.invisible?(user)
} }
|> Map.merge(Utils.make_json_ld_header()) |> Map.merge(Utils.make_json_ld_header())
end end

View File

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

View File

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