revert 745e15468e - kill yourself

revert Use same context for quote posts as the post that's being quoted (#379)

See https://akkoma.dev/AkkomaGang/akkoma/pulls/350#issuecomment-6109

When making quotes through Mast-API, they will now have the same context as the quoted post. This also results in them being showed when fetching the thread. I checked Misskey to see how it's there, and they show the quotes there as well, see e.g. <https://mk.toast.cafe/notes/98u1g0tulg>.

An example from Akkoma:

Co-authored-by: ilja <git@ilja.space>
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/379
Reviewed-by: floatingghost <hannah@coffee-and-dreams.uk>
Co-authored-by: ilja <akkoma.dev@ilja.space>
Co-committed-by: ilja <akkoma.dev@ilja.space>
This commit is contained in:
fox 2023-03-06 23:23:36 +00:00
parent c8add9d1dc
commit 92f1ea9112
3 changed files with 4 additions and 6 deletions

View file

@ -194,7 +194,7 @@ defmodule Pleroma.Web.CommonAPI.ActivityDraft do
end
defp context(draft) do
context = Utils.make_context(draft)
context = Utils.make_context(draft.in_reply_to, draft.in_reply_to_conversation)
%__MODULE__{draft | context: context}
end

View file

@ -230,13 +230,12 @@ defmodule Pleroma.Web.CommonAPI.Utils do
end
end
def make_context(%{in_reply_to_conversation: %Participation{} = participation}) do
def make_context(_, %Participation{} = participation) do
Repo.preload(participation, :conversation).conversation.ap_id
end
def make_context(%{in_reply_to: %Activity{data: %{"context" => context}}}), do: context
def make_context(%{quote: %Activity{data: %{"context" => context}}}), do: context
def make_context(_), do: Utils.generate_context_id()
def make_context(%Activity{data: %{"context" => context}}, _), do: context
def make_context(_, _), do: Utils.generate_context_id()
def maybe_add_attachments(parsed, _attachments, false = _no_links), do: parsed

View file

@ -2041,7 +2041,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
assert response["quote_id"] == quoted_status.id
assert response["quote"]["id"] == quoted_status.id
assert response["quote"]["content"] == quoted_status.object.data["content"]
assert response["pleroma"]["context"] == quoted_status.data["context"]
end
test "posting a quote, quoting a status that isn't public", %{conn: conn} do