diff options
author | rinpatch <rin@patch.cx> | 2021-03-19 08:36:26 +0000 |
---|---|---|
committer | rinpatch <rin@patch.cx> | 2021-03-19 08:36:26 +0000 |
commit | 67bde35e710e7c3c800364b4ab94a3fd81833ffa (patch) | |
tree | df6c3f8751b2267ccae032bad98aa37e7e73a33d /lib | |
parent | a2aa309496eb98625b47cfb26858e1eee3f9b0cd (diff) | |
parent | b1d4b2b81ec97143c41d16ac3f5bc2825b836f4b (diff) | |
download | pleroma-67bde35e710e7c3c800364b4ab94a3fd81833ffa.tar.gz pleroma-67bde35e710e7c3c800364b4ab94a3fd81833ffa.zip |
Merge branch 'bugfix/bridgy-user-icon' into 'develop'
Add support for actor icon being a list (Bridgy)
See merge request pleroma/pleroma!3372
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 230faf024..efbf92c70 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1383,21 +1383,17 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do defp get_actor_url(_url), do: nil - defp object_to_user_data(data) do - avatar = - data["icon"]["url"] && - %{ - "type" => "Image", - "url" => [%{"href" => data["icon"]["url"]}] - } + defp normalize_image(%{"url" => url}) do + %{ + "type" => "Image", + "url" => [%{"href" => url}] + } + end - banner = - data["image"]["url"] && - %{ - "type" => "Image", - "url" => [%{"href" => data["image"]["url"]}] - } + defp normalize_image(urls) when is_list(urls), do: urls |> List.first() |> normalize_image() + defp normalize_image(_), do: nil + defp object_to_user_data(data) do fields = data |> Map.get("attachment", []) @@ -1441,13 +1437,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do ap_id: data["id"], uri: get_actor_url(data["url"]), ap_enabled: true, - banner: banner, + banner: normalize_image(data["image"]), fields: fields, emoji: emojis, is_locked: is_locked, is_discoverable: is_discoverable, invisible: invisible, - avatar: avatar, + avatar: normalize_image(data["icon"]), name: data["name"], follower_address: data["followers"], following_address: data["following"], |