projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'mongooseim-support' into 'develop'
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
views
/
user_view.ex
diff --git
a/lib/pleroma/web/activity_pub/views/user_view.ex
b/lib/pleroma/web/activity_pub/views/user_view.ex
index 3d00dcbf29ea2271d8375de139ead7fb8e8d5d3e..1254fdf6cfdf94352ff1eba73f927f638ef0978f 100644
(file)
--- a/
lib/pleroma/web/activity_pub/views/user_view.ex
+++ b/
lib/pleroma/web/activity_pub/views/user_view.ex
@@
-69,6
+69,11
@@
defmodule Pleroma.Web.ActivityPub.UserView do
endpoints = render("endpoints.json", %{user: user})
endpoints = render("endpoints.json", %{user: user})
+ user_tags =
+ user
+ |> Transmogrifier.add_emoji_tags()
+ |> Map.get("tag", [])
+
%{
"id" => user.ap_id,
"type" => "Person",
%{
"id" => user.ap_id,
"type" => "Person",
@@
-87,16
+92,10
@@
defmodule Pleroma.Web.ActivityPub.UserView do
"publicKeyPem" => public_key
},
"endpoints" => endpoints,
"publicKeyPem" => public_key
},
"endpoints" => endpoints,
- "icon" => %{
- "type" => "Image",
- "url" => User.avatar_url(user)
- },
- "image" => %{
- "type" => "Image",
- "url" => User.banner_url(user)
- },
- "tag" => user.info.source_data["tag"] || []
+ "tag" => (user.info.source_data["tag"] || []) ++ user_tags
}
}
+ |> 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())
end
|> Map.merge(Utils.make_json_ld_header())
end
@@
-294,4
+293,17
@@
defmodule Pleroma.Web.ActivityPub.UserView do
map
end
end
map
end
end
+
+ defp maybe_make_image(func, key, user) do
+ if image = func.(user, no_default: true) do
+ %{
+ key => %{
+ "type" => "Image",
+ "url" => image
+ }
+ }
+ else
+ %{}
+ end
+ end
end
end