Provide totalItems field for featured collections
authorMark Felder <feld@feld.me>
Thu, 27 May 2021 17:04:42 +0000 (12:04 -0500)
committerMark Felder <feld@feld.me>
Thu, 27 May 2021 17:17:31 +0000 (12:17 -0500)
lib/pleroma/web/activity_pub/views/user_view.ex
test/pleroma/web/activity_pub/activity_pub_controller_test.exs

index 462f3b4a79981993db74d2e6b6355631a51e1edd..344da19d3a24f6b2c2ee887b45d8be612a7acbf2 100644 (file)
@@ -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
index cea4b3a975250d9115e6ab72fac1938aac0620ba..c1e13c7cbed2e6653263deb9fb1b99ebb30741cb 100644 (file)
@@ -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)