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 415cbd47a5ef98713034623b5ae7c4d5231b859c..1254fdf6cfdf94352ff1eba73f927f638ef0978f 100644
(file)
--- a/
lib/pleroma/web/activity_pub/views/user_view.ex
+++ b/
lib/pleroma/web/activity_pub/views/user_view.ex
@@
-5,15
+5,15
@@
defmodule Pleroma.Web.ActivityPub.UserView do
use Pleroma.Web, :view
defmodule Pleroma.Web.ActivityPub.UserView do
use Pleroma.Web, :view
- alias Pleroma.Web.WebFinger
- alias Pleroma.Web.Salmon
- alias Pleroma.User
alias Pleroma.Repo
alias Pleroma.Repo
+ alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Transmogrifier
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Transmogrifier
alias Pleroma.Web.ActivityPub.Utils
- alias Pleroma.Web.Router.Helpers
alias Pleroma.Web.Endpoint
alias Pleroma.Web.Endpoint
+ alias Pleroma.Web.Router.Helpers
+ alias Pleroma.Web.Salmon
+ alias Pleroma.Web.WebFinger
import Ecto.Query
import Ecto.Query
@@
-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