forked from mirrors/akkoma
Federate banners out.
This commit is contained in:
parent
0fbf1911f5
commit
44693c100d
2 changed files with 14 additions and 1 deletions
|
@ -34,6 +34,13 @@ defmodule Pleroma.User do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def banner_url(user) do
|
||||||
|
case user.info["banner"] do
|
||||||
|
%{"url" => [%{"href" => href} | _]} -> href
|
||||||
|
_ -> nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def ap_id(%User{nickname: nickname}) do
|
def ap_id(%User{nickname: nickname}) do
|
||||||
"#{Web.base_url}/users/#{nickname}"
|
"#{Web.base_url}/users/#{nickname}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,12 @@ defmodule Pleroma.Web.OStatus.UserRepresenter do
|
||||||
name = to_charlist(user.name)
|
name = to_charlist(user.name)
|
||||||
bio = to_charlist(user.bio)
|
bio = to_charlist(user.bio)
|
||||||
avatar_url = to_charlist(User.avatar_url(user))
|
avatar_url = to_charlist(User.avatar_url(user))
|
||||||
|
banner = if banner_url = User.banner_url(user) do
|
||||||
|
[{:link, [rel: 'header', href: banner_url], []}]
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
[
|
[
|
||||||
{:id, [ap_id]},
|
{:id, [ap_id]},
|
||||||
{:"activity:object", ['http://activitystrea.ms/schema/1.0/person']},
|
{:"activity:object", ['http://activitystrea.ms/schema/1.0/person']},
|
||||||
|
@ -15,6 +21,6 @@ defmodule Pleroma.Web.OStatus.UserRepresenter do
|
||||||
{:"poco:note", [bio]},
|
{:"poco:note", [bio]},
|
||||||
{:name, [nickname]},
|
{:name, [nickname]},
|
||||||
{:link, [rel: 'avatar', href: avatar_url], []}
|
{:link, [rel: 'avatar', href: avatar_url], []}
|
||||||
]
|
] ++ banner
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue