Fix error in outbox when no activities exist
This commit is contained in:
parent
4851b5fd61
commit
5b7a0dba6d
|
@ -50,13 +50,22 @@ defmodule ClacksWeb.OutboxController do
|
|||
end
|
||||
|
||||
defp outbox_page(conn, pagination_params, activities) do
|
||||
last_id = List.last(activities).id
|
||||
next =
|
||||
case activities do
|
||||
[] ->
|
||||
# todo: is nil the right thing here?
|
||||
nil
|
||||
|
||||
_ ->
|
||||
last_id = List.last(activities).id
|
||||
current_url(conn, %{max_id: last_id})
|
||||
end
|
||||
|
||||
%{
|
||||
"type" => "OrderedColletionPage",
|
||||
"partOf" => current_url(conn, %{}),
|
||||
"id" => current_url(conn, pagination_params),
|
||||
"next" => current_url(conn, %{max_id: last_id}),
|
||||
"next" => next,
|
||||
"orderedItems" => Enum.map(activities, & &1.data)
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue