X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Factivity_pub%2Fviews%2Fuser_view.ex;h=ffd76b5294ecaf501e056f6f451e10fc280d785b;hb=c8d418acddd72e628caad9a6b11ff6debd3386e9;hp=a1f0be9ed8e3dcdb25f0f98e37321e6087a0d84f;hpb=6c2903d9a175cfbf3785d5c1a43e6fcac6b0e9f5;p=akkoma diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index a1f0be9ed..ffd76b529 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -147,21 +147,21 @@ defmodule Pleroma.Web.ActivityPub.UserView do end end - def collection(collection, iri, page, _total \\ nil) do + def collection(collection, iri, page, total \\ nil) do offset = (page - 1) * 10 items = Enum.slice(collection, offset, 10) items = Enum.map(items, fn user -> user.ap_id end) - total = _total || length(collection) + total = total || length(collection) map = %{ "id" => "#{iri}?page=#{page}", "type" => "OrderedCollectionPage", "partOf" => iri, - "totalItems" => length(collection), + "totalItems" => total, "orderedItems" => items } - if offset < length(collection) do + if offset < total do Map.put(map, "next", "#{iri}?page=#{page + 1}") end end