From: lain Date: Tue, 5 Nov 2019 14:21:00 +0000 (+0100) Subject: Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=1bd1f62af55e01613e6362661b36a19091c87424;p=akkoma Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel --- 1bd1f62af55e01613e6362661b36a19091c87424 diff --cc lib/pleroma/object/containment.ex index edbe92381,68535c09e..c53f29cd6 --- a/lib/pleroma/object/containment.ex +++ b/lib/pleroma/object/containment.ex @@@ -32,18 -32,23 +32,35 @@@ defmodule Pleroma.Object.Containment d get_actor(%{"actor" => actor}) end + def get_object(%{"object" => id}) when is_binary(id) do + id + end + + def get_object(%{"object" => %{"id" => id}}) when is_binary(id) do + id + end + + def get_object(_) do + nil + end + + # TODO: We explicitly allow 'tag' URIs through, due to references to legacy OStatus + # objects being present in the test suite environment. Once these objects are + # removed, please also remove this. + if Mix.env() == :test do + defp compare_uris(_, %URI{scheme: "tag"}), do: :ok + end + + defp compare_uris(%URI{} = id_uri, %URI{} = other_uri) do + if id_uri.host == other_uri.host do + :ok + else + :error + end + end + + defp compare_uris(_, _), do: :error + @doc """ Checks that an imported AP object's actor matches the domain it came from. """ diff --cc lib/pleroma/web/activity_pub/activity_pub.ex index 0789ec31c,51a9c6169..72a29e50f --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@@ -147,9 -131,8 +148,9 @@@ defmodule Pleroma.Web.ActivityPub.Activ {_, true} <- {:remote_limit_error, check_remote_limit(map)}, {:ok, map} <- MRF.filter(map), {recipients, _, _} = get_recipients(map), + # ??? {:fake, false, map, recipients} <- {:fake, fake, map, recipients}, - :ok <- Containment.contain_child(map), + {:containment, :ok} <- {:containment, Containment.contain_child(map)}, {:ok, map, object} <- insert_full_object(map) do {:ok, activity} = Repo.insert(%Activity{ diff --cc test/web/mastodon_api/controllers/status_controller_test.exs index 2bbd8a151,a96fd860b..2ce201e2e --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@@ -17,8 -18,10 +18,11 @@@ defmodule Pleroma.Web.MastodonAPI.Statu alias Pleroma.Web.CommonAPI import Pleroma.Factory + import ExUnit.CaptureLog + clear_config([:instance, :federating]) + clear_config([:instance, :allow_relay]) + describe "posting statuses" do setup do user = insert(:user) diff --cc test/web/pleroma_api/controllers/account_controller_test.exs index 6a6135d02,c809f510f..c9f67c280 --- a/test/web/pleroma_api/controllers/account_controller_test.exs +++ b/test/web/pleroma_api/controllers/account_controller_test.exs @@@ -319,9 -318,9 +318,9 @@@ defmodule Pleroma.Web.PleromaAPI.Accoun conn: conn, current_user: current_user } do - user = insert(:user, %{info: %{hide_favorites: true}}) + user = insert(:user, hide_favorites: true) activity = insert(:note_activity) - CommonAPI.favorite(activity.id, user) + CommonAPI.favorite(user, activity.id) conn = conn