Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms
authorlain <lain@soykaf.club>
Mon, 4 May 2020 17:24:04 +0000 (19:24 +0200)
committerlain <lain@soykaf.club>
Mon, 4 May 2020 17:24:04 +0000 (19:24 +0200)
1  2 
lib/pleroma/web/activity_pub/transmogrifier.ex
test/web/activity_pub/object_validator_test.exs

index 7021d3f2432b483cc4142fe2703af6905ab61128,581e7040bfbbf3c2fd140e83283711e1010acb8f..b421612e53e4c9ed1366fcf0f992d22ac524404d
@@@ -657,27 -656,10 +656,20 @@@ defmodule Pleroma.Web.ActivityPub.Trans
      |> handle_incoming(options)
    end
  
 +  def handle_incoming(
 +        %{"type" => "Create", "object" => %{"type" => "ChatMessage"}} = data,
 +        _options
 +      ) do
 +    with {:ok, %User{}} <- ObjectValidator.fetch_actor(data),
 +         {:ok, activity, _} <- Pipeline.common_pipeline(data, local: false) do
 +      {:ok, activity}
 +    end
 +  end
 +
    def handle_incoming(%{"type" => "Like"} = data, _options) do
-     with {_, {:ok, cast_data_sym}} <-
-            {:casting_data,
-             data |> LikeValidator.cast_data() |> Ecto.Changeset.apply_action(:insert)},
-          cast_data = ObjectValidator.stringify_keys(Map.from_struct(cast_data_sym)),
-          :ok <- ObjectValidator.fetch_actor_and_object(cast_data),
-          {_, {:ok, cast_data}} <- {:ensure_context_presence, ensure_context_presence(cast_data)},
-          {_, {:ok, cast_data}} <-
-            {:ensure_recipients_presence, ensure_recipients_presence(cast_data)},
-          {_, {:ok, activity, _meta}} <-
-            {:common_pipeline, Pipeline.common_pipeline(cast_data, local: false)} do
+     with :ok <- ObjectValidator.fetch_actor_and_object(data),
+          {:ok, activity, _meta} <-
+            Pipeline.common_pipeline(data, local: false) do
        {:ok, activity}
      else
        e -> {:error, e}