2017-04-17 05:12:36 -07:00
|
|
|
defmodule Pleroma.Web.OStatus.UserRepresenter do
|
|
|
|
alias Pleroma.User
|
2017-04-18 09:41:51 -07:00
|
|
|
def to_simple_form(user) do
|
|
|
|
ap_id = to_charlist(user.ap_id)
|
|
|
|
nickname = to_charlist(user.nickname)
|
2017-04-22 06:11:13 -07:00
|
|
|
name = to_charlist(user.name)
|
|
|
|
bio = to_charlist(user.bio)
|
2017-04-18 09:41:51 -07:00
|
|
|
avatar_url = to_charlist(User.avatar_url(user))
|
2017-09-16 04:44:08 -07:00
|
|
|
banner = if banner_url = User.banner_url(user) do
|
|
|
|
[{:link, [rel: 'header', href: banner_url], []}]
|
|
|
|
else
|
|
|
|
[]
|
|
|
|
end
|
|
|
|
|
2017-04-18 09:41:51 -07:00
|
|
|
[
|
2017-04-27 06:18:50 -07:00
|
|
|
{:id, [ap_id]},
|
|
|
|
{:"activity:object", ['http://activitystrea.ms/schema/1.0/person']},
|
|
|
|
{:uri, [ap_id]},
|
|
|
|
{:"poco:preferredUsername", [nickname]},
|
|
|
|
{:"poco:displayName", [name]},
|
|
|
|
{:"poco:note", [bio]},
|
|
|
|
{:name, [nickname]},
|
|
|
|
{:link, [rel: 'avatar', href: avatar_url], []}
|
2017-09-16 04:44:08 -07:00
|
|
|
] ++ banner
|
2017-04-17 05:12:36 -07:00
|
|
|
end
|
|
|
|
end
|