Quote posting #113

Merged
floatingghost merged 9 commits from quote-posts into develop 2022-07-25 16:30:07 +00:00
5 changed files with 12 additions and 3 deletions
Showing only changes of commit 8902e6a37a - Show all commits

View file

@ -293,7 +293,6 @@ def get_in_reply_to_activity(%Activity{} = activity) do
end
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)
end

View file

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

View file

@ -59,6 +59,7 @@ defmacro status_object_fields do
field(:like_count, :integer, default: 0)
field(:announcement_count, :integer, default: 0)
field(:inReplyTo, ObjectValidators.ObjectID)
field(:quoteUri, ObjectValidators.ObjectID)
field(:url, ObjectValidators.Uri)
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.
"""
def fix_object(object, options \\ []) do
IO.inspect(object)
object
|> strip_internal_fields()
|> fix_actor()
@ -43,7 +44,6 @@ def fix_object(object, options \\ []) do
|> fix_content_map()
|> fix_addressing()
|> fix_summary()
|> fix_quote_url()
end
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_quote_url(%{"quoteUri" => quote} = object) when is_binary(quote) do
Map.put(object, "quoteUrl", quote)
end
def set_quote_url(obj), do: obj
@doc """
Serialized Mastodon-compatible `replies` collection containing _self-replies_.
Based on Mastodon's ActivityPub::NoteSerializer#replies.
@ -653,6 +659,7 @@ def prepare_object(object) do
|> prepare_attachments
|> set_conversation
|> set_reply_to_uri
|> set_quote_url()
|> set_replies
|> strip_internal_fields
|> strip_internal_tags

View file

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