StatusView: render the whole quoted status

This commit is contained in:
Alex Gleason 2022-01-22 20:05:58 -06:00 committed by tusooa
parent ce5eb31723
commit 0d9c443e51
No known key found for this signature in database
GPG Key ID: 42AEC43D48433C51
3 changed files with 15 additions and 1 deletions

View File

@ -193,6 +193,11 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
nullable: true, nullable: true,
description: "The `acct` property of User entity for replied user (if any)" 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{ local: %Schema{
type: :boolean, type: :boolean,
description: "`true` if the post was made on the local instance" description: "`true` if the post was made on the local instance"

View File

@ -314,6 +314,14 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
quote_activity = get_quote(activity, opts) 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 = content =
object object
|> render_content() |> render_content()
@ -422,7 +430,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
conversation_id: get_context_id(activity), conversation_id: get_context_id(activity),
context: object.data["context"], context: object.data["context"],
in_reply_to_account_acct: reply_to_user && reply_to_user.nickname, 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}, content: %{"text/plain" => content_plaintext},
spoiler_text: %{"text/plain" => summary}, spoiler_text: %{"text/plain" => summary},
expires_at: expires_at, expires_at: expires_at,

View File

@ -326,6 +326,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
conversation_id: convo_id, conversation_id: convo_id,
context: object_data["context"], context: object_data["context"],
in_reply_to_account_acct: nil, in_reply_to_account_acct: nil,
quote: nil,
content: %{"text/plain" => HTML.strip_tags(object_data["content"])}, content: %{"text/plain" => HTML.strip_tags(object_data["content"])},
spoiler_text: %{"text/plain" => HTML.strip_tags(object_data["summary"])}, spoiler_text: %{"text/plain" => HTML.strip_tags(object_data["summary"])},
expires_at: nil, expires_at: nil,