Add poco data to user.
authorRoger Braun <roger@rogerbraun.net>
Sat, 22 Apr 2017 13:11:13 +0000 (15:11 +0200)
committerRoger Braun <roger@rogerbraun.net>
Sat, 22 Apr 2017 13:11:13 +0000 (15:11 +0200)
lib/pleroma/web/ostatus/feed_representer.ex
lib/pleroma/web/ostatus/user_representer.ex
test/web/ostatus/feed_representer_test.exs
test/web/ostatus/user_representer_test.exs

index c9cd12937ae84c4b4f69bc5c9d71085eda161b0d..749cb10d0665ed27b21f0653229c37865c54d643 100644 (file)
@@ -16,7 +16,8 @@ defmodule Pleroma.Web.OStatus.FeedRepresenter do
     [{
       :feed, [
         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))},
         {:title, ['#{user.nickname}\'s timeline']},
index e7ee4cfeb88db7f6acc8cf6943a55c60e9aaffce..65dfc5643b983eb194137ec85b3fbda81284ed10 100644 (file)
@@ -3,11 +3,16 @@ defmodule Pleroma.Web.OStatus.UserRepresenter do
   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))
     [
       { :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], []}
     ]
index 1b0a100303bb1181b945de0aad233168a22bd481..a5f28f6d5cd54d356c4860ae2bf945c782a7af60 100644 (file)
@@ -22,7 +22,7 @@ defmodule Pleroma.Web.OStatus.FeedRepresenterTest do
     |> :xmerl.export_simple_content(:xmerl_xml)
 
     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>
       <title>#{user.nickname}'s timeline</title>
       <updated>#{most_recent_update}</updated>
index a401a56daecc4514bcbf82552e92952522964d44..80ac8181ad5ebffc16ef36857a328b71ad72fadc 100644 (file)
@@ -15,6 +15,9 @@ defmodule Pleroma.Web.OStatus.UserRepresenterTest do
     <id>#{user.ap_id}</id>
     <activity:object>http://activitystrea.ms/schema/1.0/person</activity:object>
     <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>
     <link rel="avatar" href="#{User.avatar_url(user)}" />
     """