Add poco data to user.

This commit is contained in:
Roger Braun 2017-04-22 15:11:13 +02:00
parent 923584d046
commit 04fb4f9c47
4 changed files with 11 additions and 2 deletions

View File

@ -16,7 +16,8 @@ defmodule Pleroma.Web.OStatus.FeedRepresenter do
[{ [{
:feed, [ :feed, [
xmlns: 'http://www.w3.org/2005/Atom', xmlns: 'http://www.w3.org/2005/Atom',
"xmlns:activity": 'http://activitystrea.ms/spec/1.0/' "xmlns:activity": 'http://activitystrea.ms/spec/1.0/',
"xmlns:poco": 'http://portablecontacts.net/spec/1.0'
], [ ], [
{:id, h.(OStatus.feed_path(user))}, {:id, h.(OStatus.feed_path(user))},
{:title, ['#{user.nickname}\'s timeline']}, {:title, ['#{user.nickname}\'s timeline']},

View File

@ -3,11 +3,16 @@ defmodule Pleroma.Web.OStatus.UserRepresenter do
def to_simple_form(user) do def to_simple_form(user) do
ap_id = to_charlist(user.ap_id) ap_id = to_charlist(user.ap_id)
nickname = to_charlist(user.nickname) nickname = to_charlist(user.nickname)
name = to_charlist(user.name)
bio = to_charlist(user.bio)
avatar_url = to_charlist(User.avatar_url(user)) avatar_url = to_charlist(User.avatar_url(user))
[ [
{ :id, [ap_id] }, { :id, [ap_id] },
{ :"activity:object", ['http://activitystrea.ms/schema/1.0/person'] }, { :"activity:object", ['http://activitystrea.ms/schema/1.0/person'] },
{ :uri, [ap_id] }, { :uri, [ap_id] },
{ :"poco:preferredUsername", [nickname] },
{ :"poco:displayName", [name] },
{ :"poco:note", [bio] },
{ :name, [nickname] }, { :name, [nickname] },
{ :link, [rel: 'avatar', href: avatar_url], []} { :link, [rel: 'avatar', href: avatar_url], []}
] ]

View File

@ -22,7 +22,7 @@ defmodule Pleroma.Web.OStatus.FeedRepresenterTest do
|> :xmerl.export_simple_content(:xmerl_xml) |> :xmerl.export_simple_content(:xmerl_xml)
expected = """ expected = """
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:activity="http://activitystrea.ms/spec/1.0/"> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:poco="http://portablecontacts.net/spec/1.0">
<id>#{OStatus.feed_path(user)}</id> <id>#{OStatus.feed_path(user)}</id>
<title>#{user.nickname}'s timeline</title> <title>#{user.nickname}'s timeline</title>
<updated>#{most_recent_update}</updated> <updated>#{most_recent_update}</updated>

View File

@ -15,6 +15,9 @@ defmodule Pleroma.Web.OStatus.UserRepresenterTest do
<id>#{user.ap_id}</id> <id>#{user.ap_id}</id>
<activity:object>http://activitystrea.ms/schema/1.0/person</activity:object> <activity:object>http://activitystrea.ms/schema/1.0/person</activity:object>
<uri>#{user.ap_id}</uri> <uri>#{user.ap_id}</uri>
<poco:preferredUsername>#{user.nickname}</poco:preferredUsername>
<poco:displayName>#{user.name}</poco:displayName>
<poco:note>#{user.bio}</poco:note>
<name>#{user.nickname}</name> <name>#{user.nickname}</name>
<link rel="avatar" href="#{User.avatar_url(user)}" /> <link rel="avatar" href="#{User.avatar_url(user)}" />
""" """