diff options
author | lain <lain@soykaf.club> | 2020-07-06 11:38:40 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-06 11:38:40 +0200 |
commit | 208baf157ad0c8be470566d5d51d0214c229e6a5 (patch) | |
tree | 6f152bb068f3fd22f020ee8bdbee005d96c7d466 /lib/pleroma | |
parent | 74b88c0a8bb12c3d534c826d6d1547bc40fff634 (diff) | |
download | pleroma-208baf157ad0c8be470566d5d51d0214c229e6a5.tar.gz |
ActivityPub: Add new 'capabilities' to user.
Diffstat (limited to 'lib/pleroma')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 3 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/views/user_view.ex | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 86428b861..17c9d8f21 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1224,7 +1224,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end) locked = data["manuallyApprovesFollowers"] || false - accepts_chat_messages = data["acceptsChatMessages"] + capabilities = data["capabilities"] || %{} + accepts_chat_messages = capabilities["acceptsChatMessages"] data = Transmogrifier.maybe_fix_user_object(data) discoverable = data["discoverable"] || false invisible = data["invisible"] || false diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index d062d6230..3a4564912 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -81,7 +81,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do fields = Enum.map(user.fields, &Map.put(&1, "type", "PropertyValue")) - chat_message_acceptance = + capabilities = if is_boolean(user.accepts_chat_messages) do %{ "acceptsChatMessages" => user.accepts_chat_messages @@ -110,9 +110,9 @@ defmodule Pleroma.Web.ActivityPub.UserView do "endpoints" => endpoints, "attachment" => fields, "tag" => emoji_tags, - "discoverable" => user.discoverable + "discoverable" => user.discoverable, + "capabilities" => capabilities } - |> Map.merge(chat_message_acceptance) |> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user)) |> Map.merge(maybe_make_image(&User.banner_url/2, "image", user)) |> Map.merge(Utils.make_json_ld_header()) |