aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhakabahitoyo <hakabahitoyo@example.com>2018-02-09 23:03:28 +0900
committerHakaba Hitoyo <example@example.com>2018-02-09 23:10:32 +0900
commita61f21ff4f825bc11b9d1c7c23baa3d2820cd718 (patch)
treeb8e14ea773bcb3811a0f18d3d9e93c87954e504d /lib
parent7124f12a94478206f600b93055e0a82b945de858 (diff)
downloadpleroma-a61f21ff4f825bc11b9d1c7c23baa3d2820cd718.tar.gz
print <link rel="next"> element in atom.feed
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/ostatus/feed_representer.ex12
1 files changed, 11 insertions, 1 deletions
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 @@ defmodule Pleroma.Web.OStatus.FeedRepresenter 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 @@ defmodule Pleroma.Web.OStatus.FeedRepresenter 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