Merge branch 'featured-totalItems' into 'develop'

Add missing totalItems field for featured collections

See merge request pleroma/pleroma!3416
This commit is contained in:
Haelwenn 2021-05-27 21:01:54 +00:00
commit a01093c505
3 changed files with 4 additions and 2 deletions

View File

@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Return OAuth token `id` (primary key) in POST `/oauth/token`. - Return OAuth token `id` (primary key) in POST `/oauth/token`.
- `AnalyzeMetadata` upload filter for extracting attachment dimensions and generating blurhashes. - `AnalyzeMetadata` upload filter for extracting attachment dimensions and generating blurhashes.
- Attachment dimensions and blurhashes are federated when available. - Attachment dimensions and blurhashes are federated when available.
- Pinned posts federation
### Fixed ### Fixed
- Don't crash so hard when email settings are invalid. - Don't crash so hard when email settings are invalid.

View File

@ -261,7 +261,8 @@ def render("featured.json", %{
%{ %{
"id" => featured_address, "id" => featured_address,
"type" => "OrderedCollection", "type" => "OrderedCollection",
"orderedItems" => objects "orderedItems" => objects,
"totalItems" => length(objects)
} }
|> Map.merge(Utils.make_json_ld_header()) |> Map.merge(Utils.make_json_ld_header())
end end

View File

@ -1966,7 +1966,7 @@ test "pinned collection", %{conn: conn} do
%{nickname: nickname, featured_address: featured_address, pinned_objects: pinned_objects} = %{nickname: nickname, featured_address: featured_address, pinned_objects: pinned_objects} =
refresh_record(user) refresh_record(user)
%{"id" => ^featured_address, "orderedItems" => items} = %{"id" => ^featured_address, "orderedItems" => items, "totalItems" => 2} =
conn conn
|> get("/users/#{nickname}/collections/featured") |> get("/users/#{nickname}/collections/featured")
|> json_response(200) |> json_response(200)