mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-24 23:31:00 +00:00
38 lines
939 B
Elixir
38 lines
939 B
Elixir
defmodule Pleroma.Web.OStatus.UserRepresenter do
|
|
alias Pleroma.User
|
|
|
|
def to_simple_form(user) do
|
|
ap_id = to_charlist(user.ap_id)
|
|
nickname = to_charlist(user.nickname)
|
|
name = to_charlist(user.name)
|
|
bio = to_charlist(user.bio)
|
|
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
|
|
|
|
ap_enabled =
|
|
if user.local do
|
|
[{:ap_enabled, ['true']}]
|
|
else
|
|
[]
|
|
end
|
|
|
|
[
|
|
{:id, [ap_id]},
|
|
{:"activity:object", ['http://activitystrea.ms/schema/1.0/person']},
|
|
{:uri, [ap_id]},
|
|
{:"poco:preferredUsername", [nickname]},
|
|
{:"poco:displayName", [name]},
|
|
{:"poco:note", [bio]},
|
|
{:summary, [bio]},
|
|
{:name, [nickname]},
|
|
{:link, [rel: 'avatar', href: avatar_url], []}
|
|
] ++ banner ++ ap_enabled
|
|
end
|
|
end
|