StatusView: return quote post inside a reblog

This commit is contained in:
Alex Gleason 2022-01-28 12:33:07 -06:00 committed by tusooa
parent 93e4972b50
commit cf8e425883
No known key found for this signature in database
GPG Key ID: 42AEC43D48433C51
2 changed files with 18 additions and 4 deletions

View File

@ -668,13 +668,15 @@ def get_reply_to(%{data: %{"object" => _object}} = activity, _) do
end end
end end
def get_quote(_activity, %{show_quote: false}) do def get_quote(_activity, %{show_quote: false}), do: nil
nil
end
def get_quote(activity, %{quoted_activities: quoted_activities}) do def get_quote(activity, %{quoted_activities: quoted_activities}) do
object = Object.normalize(activity, fetch: false) object = Object.normalize(activity, fetch: false)
quoted_activities[object.data["quoteUrl"]]
with nil <- quoted_activities[object.data["quoteUrl"]] do
# For when a quote post is inside an Announce
Activity.get_create_by_object_ap_id_with_object(object.data["quoteUrl"])
end
end end
def get_quote(%{data: %{"object" => _object}} = activity, _) do def get_quote(%{data: %{"object" => _object}} = activity, _) do

View File

@ -491,6 +491,18 @@ test "quoted direct message" do
refute status.pleroma.quote_visible refute status.pleroma.quote_visible
end end
test "repost of quote post" do
post = insert(:note_activity)
user = insert(:user)
{:ok, quote_post} = CommonAPI.post(user, %{status: "he", quote_id: post.id})
{:ok, repost} = CommonAPI.repeat(quote_post.id, user)
[status] = StatusView.render("index.json", %{activities: [repost], as: :activity})
assert status.reblog.pleroma.quote.id == to_string(post.id)
end
test "contains mentions" do test "contains mentions" do
user = insert(:user) user = insert(:user)
mentioned = insert(:user) mentioned = insert(:user)