X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Factivity_pub%2Factivity_pub.ex;h=a7b2988b9afe506c352e107c304c852e8a06e836;hb=5454ec6a6ccedb2647cb765251e4cef3df2fcaf3;hp=6e29768d14d8090286d9cccc24cdadab2de337e5;hpb=8cf97ee8e15a36cbbf0964d5be53c88d29798163;p=akkoma diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 6e29768d1..a7b2988b9 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1,6 +1,5 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do alias Pleroma.{Activity, Repo, Object, Upload, User, Notification} - alias Pleroma.Web.OStatus import Ecto.Query import Pleroma.Web.ActivityPub.Utils require Logger @@ -37,7 +36,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end end - def create(to, actor, context, object, additional \\ %{}, published \\ nil, local \\ true) do + def create(%{to: to, actor: actor, context: context, object: object} = params) do + additional = params[:additional] || %{} + local = !(params[:local] == false) # only accept false as false value + published = params[:published] + with create_data <- make_create_data(%{to: to, actor: actor, published: published, context: context, object: object}, additional), {:ok, activity} <- insert(create_data, local), :ok <- maybe_federate(activity) do @@ -247,18 +250,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do |> Map.put("@context", "https://www.w3.org/ns/activitystreams") end - def prepare_incoming(%{"type" => "Create", "object" => %{"type" => "Note"} = object} = data) do - with {:ok, user} <- OStatus.find_or_make_user(data["actor"]) do - {:ok, data} - else - _e -> :error - end - end - - def prepare_incoming(_) do - :error - end - def publish(actor, activity) do remote_users = Pleroma.Web.Salmon.remote_users(activity) data = sanitize_outgoing_activity_data(activity.data)