diff options
Diffstat (limited to 'lib/pleroma/web/ostatus/feed_representer.ex')
-rw-r--r-- | lib/pleroma/web/ostatus/feed_representer.ex | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/pleroma/web/ostatus/feed_representer.ex b/lib/pleroma/web/ostatus/feed_representer.ex new file mode 100644 index 000000000..cb76022fe --- /dev/null +++ b/lib/pleroma/web/ostatus/feed_representer.ex @@ -0,0 +1,26 @@ +defmodule Pleroma.Web.OStatus.FeedRepresenter do + alias Pleroma.Web.OStatus + alias Pleroma.Web.OStatus.UserRepresenter + + def to_simple_form(user, activities, users) do + most_recent_update = List.first(activities).updated_at + |> NaiveDateTime.to_iso8601 + + h = fn(str) -> [to_charlist(str)] end + + entries = [] + [{ + :feed, [ + xmlns: 'http://www.w3.org/2005/Atom', + "xmlns:activity": 'http://activitystrea.ms/spec/1.0/' + ], [ + {:id, h.(OStatus.feed_path(user))}, + {:title, ['#{user.nickname}\'s timeline']}, + {:updated, h.(most_recent_update)}, + {:entries, []}, + {:link, [rel: 'hub', href: h.(OStatus.pubsub_path)], []}, + {:author, UserRepresenter.to_simple_form(user)} + ] + }] + end +end |