From 7a884d70d8fd92a44c35911509b248a902275e07 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 4 May 2018 22:31:46 +0000 Subject: [PATCH] Group def renders here as well --- .../web/activity_pub/views/user_view.ex | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index d6bf71884..156a12f26 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -47,25 +47,6 @@ def render("user.json", %{user: user}) do |> Map.merge(Utils.make_json_ld_header()) end - 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) - - map = %{ - "id" => "#{iri}?page=#{page}", - "type" => "OrderedCollectionPage", - "partOf" => iri, - "totalItems" => length(collection), - "orderedItems" => items - } - - if offset < length(collection) do - Map.put(map, "next", "#{iri}?page=#{page + 1}") - end - end - def render("following.json", %{user: user, page: page}) do query = User.get_friends_query(user) query = from(user in query, select: [:ap_id]) @@ -162,4 +143,23 @@ def render("outbox.json", %{user: user, max_id: max_qid}) do page |> Map.merge(Utils.make_json_ld_header()) end end + + 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) + + map = %{ + "id" => "#{iri}?page=#{page}", + "type" => "OrderedCollectionPage", + "partOf" => iri, + "totalItems" => length(collection), + "orderedItems" => items + } + + if offset < length(collection) do + Map.put(map, "next", "#{iri}?page=#{page + 1}") + end + end end