mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-04-22 10:54:08 +00:00
Fix set_replies for objects without ids
Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
parent
ebb8fb8a78
commit
8cc7d7044c
1 changed files with 6 additions and 4 deletions
|
@ -711,16 +711,18 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
Serialized Mastodon-compatible `replies` collection containing _self-replies_.
|
||||
Based on Mastodon's ActivityPub::NoteSerializer#replies.
|
||||
"""
|
||||
def set_replies(obj_data) do
|
||||
def set_replies(%{"id" => object_id} = object) do
|
||||
replies_collection = %{
|
||||
"id" => obj_data["id"] <> "/replies",
|
||||
"id" => object_id <> "/replies",
|
||||
"type" => "OrderedCollection",
|
||||
"first" => obj_data["id"] <> "/replies?page=true"
|
||||
"first" => object_id <> "/replies?page=true"
|
||||
}
|
||||
|
||||
Map.merge(obj_data, %{"replies" => replies_collection})
|
||||
Map.merge(object, %{"replies" => replies_collection})
|
||||
end
|
||||
|
||||
def set_replies(object), do: object
|
||||
|
||||
def replies(%{"replies" => %{"first" => %{"items" => items}}}) when not is_nil(items) do
|
||||
items
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue