From 04fb4f9c47b273256d628eefa5bd8af77cca31fb Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sat, 22 Apr 2017 15:11:13 +0200 Subject: [PATCH] Add poco data to user. --- lib/pleroma/web/ostatus/feed_representer.ex | 3 ++- lib/pleroma/web/ostatus/user_representer.ex | 5 +++++ test/web/ostatus/feed_representer_test.exs | 2 +- test/web/ostatus/user_representer_test.exs | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/ostatus/feed_representer.ex b/lib/pleroma/web/ostatus/feed_representer.ex index c9cd12937..749cb10d0 100644 --- a/lib/pleroma/web/ostatus/feed_representer.ex +++ b/lib/pleroma/web/ostatus/feed_representer.ex @@ -16,7 +16,8 @@ def to_simple_form(user, activities, users) 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']}, diff --git a/lib/pleroma/web/ostatus/user_representer.ex b/lib/pleroma/web/ostatus/user_representer.ex index e7ee4cfeb..65dfc5643 100644 --- a/lib/pleroma/web/ostatus/user_representer.ex +++ b/lib/pleroma/web/ostatus/user_representer.ex @@ -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], []} ] diff --git a/test/web/ostatus/feed_representer_test.exs b/test/web/ostatus/feed_representer_test.exs index 1b0a10030..a5f28f6d5 100644 --- a/test/web/ostatus/feed_representer_test.exs +++ b/test/web/ostatus/feed_representer_test.exs @@ -22,7 +22,7 @@ test "returns a feed of the last 20 items of the user" do |> :xmerl.export_simple_content(:xmerl_xml) expected = """ - + #{OStatus.feed_path(user)} #{user.nickname}'s timeline #{most_recent_update} diff --git a/test/web/ostatus/user_representer_test.exs b/test/web/ostatus/user_representer_test.exs index a401a56da..80ac8181a 100644 --- a/test/web/ostatus/user_representer_test.exs +++ b/test/web/ostatus/user_representer_test.exs @@ -15,6 +15,9 @@ test "returns a user with id, uri, name and link" do #{user.ap_id} http://activitystrea.ms/schema/1.0/person #{user.ap_id} + #{user.nickname} + #{user.name} + #{user.bio} #{user.nickname} """