logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 46948537664a4296e7d5c517cbdbf3adccef1272
parent f34e22bba22e041a72ae379e3ac3807a00af9a8e
Author: Mark Felder <feld@feld.me>
Date:   Thu, 27 May 2021 12:04:42 -0500

Provide totalItems field for featured collections

Diffstat:

Mlib/pleroma/web/activity_pub/views/user_view.ex3++-
Mtest/pleroma/web/activity_pub/activity_pub_controller_test.exs2+-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -261,7 +261,8 @@ defmodule Pleroma.Web.ActivityPub.UserView do %{ "id" => featured_address, "type" => "OrderedCollection", - "orderedItems" => objects + "orderedItems" => objects, + "totalItems" => length(objects) } |> Map.merge(Utils.make_json_ld_header()) end diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -1966,7 +1966,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do %{nickname: nickname, featured_address: featured_address, pinned_objects: pinned_objects} = refresh_record(user) - %{"id" => ^featured_address, "orderedItems" => items} = + %{"id" => ^featured_address, "orderedItems" => items, "totalItems" => 2} = conn |> get("/users/#{nickname}/collections/featured") |> json_response(200)