Linkify custom fields values in ActivityPub.UserViewx
This commit is contained in:
parent
5178f960c3
commit
7d6f8a7fd7
@ -84,6 +84,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
|||||||
user.info
|
user.info
|
||||||
|> User.Info.fields()
|
|> User.Info.fields()
|
||||||
|> Enum.map(&Map.put(&1, "type", "PropertyValue"))
|
|> Enum.map(&Map.put(&1, "type", "PropertyValue"))
|
||||||
|
|> Enum.map(fn f -> Map.update!(f, "value", &AutoLinker.link(&1)) end)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
"id" => user.ap_id,
|
"id" => user.ap_id,
|
||||||
|
@ -33,7 +33,11 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
|
|||||||
assert %{
|
assert %{
|
||||||
"attachment" => [
|
"attachment" => [
|
||||||
%{"name" => "foo", "type" => "PropertyValue", "value" => "bar"},
|
%{"name" => "foo", "type" => "PropertyValue", "value" => "bar"},
|
||||||
%{"name" => "website", "type" => "PropertyValue", "value" => "cofe.my"}
|
%{
|
||||||
|
"name" => "website",
|
||||||
|
"type" => "PropertyValue",
|
||||||
|
"value" => "<a href=\"http://cofe.my\">cofe.my</a>"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
} = UserView.render("user.json", %{user: user})
|
} = UserView.render("user.json", %{user: user})
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user