1
0

StatusView: render the whole quoted status

This commit is contained in:
Alex Gleason
2022-01-22 20:05:58 -06:00
parent 0584a6f131
commit d4e9cb600d
3 changed files with 15 additions and 1 deletions
@@ -177,6 +177,11 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
nullable: true,
description: "The `acct` property of User entity for replied user (if any)"
},
quote: %Schema{
allOf: [%OpenApiSpex.Reference{"$ref": "#/components/schemas/Status"}],
nullable: true,
description: "Quoted status (if any)"
},
local: %Schema{
type: :boolean,
description: "`true` if the post was made on the local instance"
@@ -286,6 +286,14 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
quote_activity = get_quote(activity, opts)
quote_post =
if quote_activity do
quote_rendering_opts = Map.put(opts, :activity, quote_activity)
render("show.json", quote_rendering_opts)
else
nil
end
content =
object
|> render_content()
@@ -392,7 +400,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
local: activity.local,
conversation_id: get_context_id(activity),
in_reply_to_account_acct: reply_to_user && reply_to_user.nickname,
quote_id: quote_activity && to_string(quote_activity.id),
quote: quote_post,
content: %{"text/plain" => content_plaintext},
spoiler_text: %{"text/plain" => summary},
expires_at: expires_at,
@@ -280,6 +280,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
local: true,
conversation_id: convo_id,
in_reply_to_account_acct: nil,
quote: nil,
content: %{"text/plain" => HTML.strip_tags(object_data["content"])},
spoiler_text: %{"text/plain" => HTML.strip_tags(object_data["summary"])},
expires_at: nil,