Quote posting #113
9 changed files with 34 additions and 21 deletions
|
@ -163,7 +163,6 @@ defp fix(data) do
|
|||
end
|
||||
|
||||
def changeset(struct, data) do
|
||||
IO.inspect(data)
|
||||
data = fix(data)
|
||||
|
||||
struct
|
||||
|
|
|
@ -31,7 +31,6 @@ 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()
|
||||
|
|
|
@ -500,8 +500,7 @@ defp create_request do
|
|||
quote_id: %Schema{
|
||||
nullable: true,
|
||||
type: :string,
|
||||
description:
|
||||
"Will quote a given status."
|
||||
description: "Will quote a given status."
|
||||
}
|
||||
},
|
||||
example: %{
|
||||
|
|
|
@ -139,7 +139,9 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
|
|||
nullable: true
|
||||
},
|
||||
quote: %Schema{
|
||||
|
||||
allOf: [%OpenApiSpex.Reference{"$ref": "#/components/schemas/Status"}],
|
||||
nullable: true,
|
||||
description: "Quoted status (if any)"
|
||||
},
|
||||
pleroma: %Schema{
|
||||
type: :object,
|
||||
|
@ -216,18 +218,26 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
|
|||
type: :object,
|
||||
properties: %{
|
||||
source: %Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
content: %Schema{
|
||||
type: :string,
|
||||
description: "The source content of the status"
|
||||
},
|
||||
mediaType: %Schema{
|
||||
type: :string,
|
||||
description: "The source MIME type of the status",
|
||||
example: "text/plain"
|
||||
},
|
||||
}
|
||||
nullable: true,
|
||||
oneOf: [
|
||||
%Schema{type: :string, example: 'plaintext content'},
|
||||
%Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
content: %Schema{
|
||||
type: :string,
|
||||
description: "The source content of the status",
|
||||
nullable: true
|
||||
},
|
||||
mediaType: %Schema{
|
||||
type: :string,
|
||||
description: "The source MIME type of the status",
|
||||
example: "text/plain",
|
||||
nullable: true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -39,7 +39,6 @@ defmodule Pleroma.Web.CommonAPI.ActivityDraft do
|
|||
preview?: false,
|
||||
changes: %{}
|
||||
|
||||
|
||||
def new(user, params) do
|
||||
%__MODULE__{user: user}
|
||||
|> put_params(params)
|
||||
|
@ -118,6 +117,7 @@ defp quote_id(%{params: %{quote_id: id}} = draft) when is_binary(id) do
|
|||
quote = Activity.get_by_id(id)
|
||||
# only quote public/unlisted statuses
|
||||
visibility = CommonAPI.get_quoted_visibility(quote)
|
||||
|
||||
if visibility in ["public", "unlisted"] do
|
||||
%__MODULE__{draft | quote: Activity.get_by_id(id)}
|
||||
else
|
||||
|
|
|
@ -112,7 +112,6 @@ def perform(:incoming_ap_doc, params) do
|
|||
e ->
|
||||
# Just drop those for now
|
||||
Logger.debug(fn -> "Unhandled activity\n" <> Jason.encode!(params, pretty: true) end)
|
||||
IO.inspect(e)
|
||||
{:error, e}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -365,7 +365,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity}
|
|||
application: build_application(object.data["generator"]),
|
||||
language: nil,
|
||||
emojis: build_emojis(object.data["emoji"]),
|
||||
quote_id: (if quote, do: quote.id, else: nil),
|
||||
quote_id: if(quote, do: quote.id, else: nil),
|
||||
quote: maybe_render_quote(quote, opts),
|
||||
pleroma: %{
|
||||
local: activity.local,
|
||||
|
@ -619,6 +619,7 @@ defp maybe_render_quote(quote, opts) do
|
|||
opts
|
||||
|> Map.put(:activity, quote)
|
||||
|> Map.put(:do_not_recurse, true)
|
||||
|
||||
render("show.json", opts)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
"ostatus": "http://ostatus.org#",
|
||||
"schema": "http://schema.org#",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"misskey": "https://misskey-hub.net/ns#",
|
||||
"fedibird": "http://fedibird.com/ns#",
|
||||
"value": "schema:value",
|
||||
"sensitive": "as:sensitive",
|
||||
"litepub": "http://litepub.social/ns#",
|
||||
|
@ -26,6 +28,8 @@
|
|||
"@id": "litepub:listMessage",
|
||||
"@type": "@id"
|
||||
},
|
||||
"quoteUrl": "as:quoteUrl",
|
||||
"quoteUri": "fedibird:quoteUri",
|
||||
"oauthRegistrationEndpoint": {
|
||||
"@id": "litepub:oauthRegistrationEndpoint",
|
||||
"@type": "@id"
|
||||
|
|
|
@ -305,7 +305,9 @@ test "a note activity" do
|
|||
},
|
||||
akkoma: %{
|
||||
source: HTML.filter_tags(object_data["content"])
|
||||
}
|
||||
},
|
||||
quote_id: nil,
|
||||
quote: nil
|
||||
}
|
||||
|
||||
assert status == expected
|
||||
|
|
Loading…
Reference in a new issue