add quoteUri to outbounds, inbounds

This commit is contained in:
FloatingGhost 2022-07-23 18:25:18 +01:00
parent e8226ca0c3
commit 8902e6a37a
5 changed files with 12 additions and 3 deletions

View file

@ -293,7 +293,6 @@ def get_in_reply_to_activity(%Activity{} = activity) do
end end
def get_quoted_activity_from_object(%Object{data: %{"quoteUri" => ap_id}}) do def get_quoted_activity_from_object(%Object{data: %{"quoteUri" => ap_id}}) do
IO.puts(ap_id)
get_create_by_object_ap_id_with_object(ap_id) get_create_by_object_ap_id_with_object(ap_id)
end end

View file

@ -156,12 +156,14 @@ defp fix(data) do
|> fix_replies() |> fix_replies()
|> fix_source() |> fix_source()
|> fix_misskey_content() |> fix_misskey_content()
|> Transmogrifier.fix_quote_url()
|> Transmogrifier.fix_attachments() |> Transmogrifier.fix_attachments()
|> Transmogrifier.fix_emoji() |> Transmogrifier.fix_emoji()
|> Transmogrifier.fix_content_map() |> Transmogrifier.fix_content_map()
end end
def changeset(struct, data) do def changeset(struct, data) do
IO.inspect(data)
data = fix(data) data = fix(data)
struct struct

View file

@ -59,6 +59,7 @@ defmacro status_object_fields do
field(:like_count, :integer, default: 0) field(:like_count, :integer, default: 0)
field(:announcement_count, :integer, default: 0) field(:announcement_count, :integer, default: 0)
field(:inReplyTo, ObjectValidators.ObjectID) field(:inReplyTo, ObjectValidators.ObjectID)
field(:quoteUri, ObjectValidators.ObjectID)
field(:url, ObjectValidators.Uri) field(:url, ObjectValidators.Uri)
field(:likes, {:array, ObjectValidators.ObjectID}, default: []) field(:likes, {:array, ObjectValidators.ObjectID}, default: [])

View file

@ -31,6 +31,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
Modifies an incoming AP object (mastodon format) to our internal format. Modifies an incoming AP object (mastodon format) to our internal format.
""" """
def fix_object(object, options \\ []) do def fix_object(object, options \\ []) do
IO.inspect(object)
object object
|> strip_internal_fields() |> strip_internal_fields()
|> fix_actor() |> fix_actor()
@ -43,7 +44,6 @@ def fix_object(object, options \\ []) do
|> fix_content_map() |> fix_content_map()
|> fix_addressing() |> fix_addressing()
|> fix_summary() |> fix_summary()
|> fix_quote_url()
end end
def fix_summary(%{"summary" => nil} = object) do def fix_summary(%{"summary" => nil} = object) do
@ -599,6 +599,12 @@ def set_reply_to_uri(%{"inReplyTo" => in_reply_to} = object) when is_binary(in_r
def set_reply_to_uri(obj), do: obj def set_reply_to_uri(obj), do: obj
def set_quote_url(%{"quoteUri" => quote} = object) when is_binary(quote) do
Map.put(object, "quoteUrl", quote)
end
def set_quote_url(obj), do: obj
@doc """ @doc """
Serialized Mastodon-compatible `replies` collection containing _self-replies_. Serialized Mastodon-compatible `replies` collection containing _self-replies_.
Based on Mastodon's ActivityPub::NoteSerializer#replies. Based on Mastodon's ActivityPub::NoteSerializer#replies.
@ -653,6 +659,7 @@ def prepare_object(object) do
|> prepare_attachments |> prepare_attachments
|> set_conversation |> set_conversation
|> set_reply_to_uri |> set_reply_to_uri
|> set_quote_url()
|> set_replies |> set_replies
|> strip_internal_fields |> strip_internal_fields
|> strip_internal_tags |> strip_internal_tags

View file

@ -222,7 +222,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
type: :string, type: :string,
description: "The source content of the status" description: "The source content of the status"
}, },
mediaType: %{ mediaType: %Schema{
type: :string, type: :string,
description: "The source MIME type of the status", description: "The source MIME type of the status",
example: "text/plain" example: "text/plain"