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.
"""
{_, 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{
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)
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