Merge branch 'merge-upstream' into 'develop'

StatusView: return quote post inside a reblog

See merge request soapbox-pub/soapbox!85
This commit is contained in:
Alex Gleason 2022-01-28 18:48:44 +00:00
commit 053d23f065
2 changed files with 18 additions and 4 deletions

View file

@ -514,13 +514,15 @@ def get_reply_to(%{data: %{"object" => _object}} = activity, _) do
end
end
def get_quote(_activity, %{show_quote: false}) do
nil
end
def get_quote(_activity, %{show_quote: false}), do: nil
def get_quote(activity, %{quoted_activities: quoted_activities}) do
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
def get_quote(%{data: %{"object" => _object}} = activity, _) do

View file

@ -446,6 +446,18 @@ test "quoted direct message" do
refute status.pleroma.quote_visible
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
user = insert(:user)
mentioned = insert(:user)