forked from AkkomaGang/akkoma
print <link rel="next"> element in atom.feed
This commit is contained in:
parent
7124f12a94
commit
a61f21ff4f
1 changed files with 11 additions and 1 deletions
|
@ -10,6 +10,8 @@ def to_simple_form(user, activities, _users) do
|
||||||
|
|
||||||
h = fn(str) -> [to_charlist(str)] end
|
h = fn(str) -> [to_charlist(str)] end
|
||||||
|
|
||||||
|
last_activity = List.last(activities)
|
||||||
|
|
||||||
entries = activities
|
entries = activities
|
||||||
|> Enum.map(fn(activity) ->
|
|> Enum.map(fn(activity) ->
|
||||||
{:entry, ActivityRepresenter.to_simple_form(activity, user)}
|
{: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: 'salmon', href: h.(OStatus.salmon_path(user))], []},
|
||||||
{:link, [rel: 'self', href: h.(OStatus.feed_path(user)), type: 'application/atom+xml'], []},
|
{:link, [rel: 'self', href: h.(OStatus.feed_path(user)), type: 'application/atom+xml'], []},
|
||||||
{:author, UserRepresenter.to_simple_form(user)},
|
{: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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue