From: lain Date: Mon, 4 May 2020 17:24:04 +0000 (+0200) Subject: Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=c23cb8d37a44e4b9ff09655e452122235ded1d84;p=akkoma Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms --- c23cb8d37a44e4b9ff09655e452122235ded1d84 diff --cc lib/pleroma/web/activity_pub/transmogrifier.ex index 7021d3f24,581e7040b..b421612e5 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@@ -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}