From a61f21ff4f825bc11b9d1c7c23baa3d2820cd718 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Fri, 9 Feb 2018 23:03:28 +0900 Subject: [PATCH] print element in atom.feed --- lib/pleroma/web/ostatus/feed_representer.ex | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/ostatus/feed_representer.ex b/lib/pleroma/web/ostatus/feed_representer.ex index 10860ce04..8461b2b9f 100644 --- a/lib/pleroma/web/ostatus/feed_representer.ex +++ b/lib/pleroma/web/ostatus/feed_representer.ex @@ -10,6 +10,8 @@ def to_simple_form(user, activities, _users) do h = fn(str) -> [to_charlist(str)] end + last_activity = List.last(activities) + entries = activities |> Enum.map(fn(activity) -> {:entry, ActivityRepresenter.to_simple_form(activity, user)} @@ -32,7 +34,15 @@ def to_simple_form(user, activities, _users) do {:link, [rel: 'salmon', href: h.(OStatus.salmon_path(user))], []}, {:link, [rel: 'self', href: h.(OStatus.feed_path(user)), type: 'application/atom+xml'], []}, {:author, UserRepresenter.to_simple_form(user)}, - ] ++ entries + ] ++ + if last_activity do + [{:link, [rel: 'next', + href: to_charlist(OStatus.feed_path(user)) ++ '?max_id=' ++ to_charlist(last_activity.id), + type: 'application/atom+xml'], []}] + else + [] + end + ++ entries }] end end