end
defp set_replies(obj, replies_uris) do
- # Note: stubs (Mastodon doesn't make separate requests via those URIs in FetchRepliesService)
- masto_replies_uri = nil
- masto_replies_next_page_uri = nil
-
replies_collection = %{
"type" => "Collection",
- "id" => masto_replies_uri,
- "first" => %{
- "type" => "Collection",
- "part_of" => masto_replies_uri,
- "items" => replies_uris,
- "next" => masto_replies_next_page_uri
- }
+ "items" => replies_uris
}
Map.merge(obj, %{"replies" => replies_collection})
%{data: data, items: items, collection: collection}
end
+ # Mastodon wraps reply URIs in `replies->first->items`
test "with wrapped `replies` collection, it schedules background fetching of items", %{
data: data,
items: items,
end
end
+ # Pleroma outputs reply URIs as `replies->items`
test "it schedules background fetching of unwrapped `replies` collection items", %{
data: data,
items: items,
object = Object.normalize(activity)
replies_uris = Enum.map([self_reply1, self_reply2], fn a -> a.object.data["id"] end)
- assert %{
- "type" => "Collection",
- "first" => %{"type" => "Collection", "items" => ^replies_uris}
- } = Transmogrifier.set_replies(object.data)["replies"]
+ assert %{"type" => "Collection", "items" => ^replies_uris} =
+ Transmogrifier.set_replies(object.data)["replies"]
end
end
end
replies_uris = [self_reply1.object.data["id"]]
result = ObjectView.render("object.json", %{object: refresh_record(activity)})
- assert %{
- "type" => "Collection",
- "first" => %{"type" => "Collection", "items" => ^replies_uris}
- } = get_in(result, ["object", "replies"])
+ assert %{"type" => "Collection", "items" => ^replies_uris} =
+ get_in(result, ["object", "replies"])
end
end