Transmogrifier: Remove ChatMessageHandling module.

This commit is contained in:
lain 2020-04-29 13:52:23 +02:00
parent e055b8d203
commit 53e3063bd0
3 changed files with 14 additions and 33 deletions

View file

@ -19,17 +19,12 @@ def handle(object, meta \\ [])
# - Add like to object
# - Set up notification
def handle(%{data: %{"type" => "Like"}} = object, meta) do
{:ok, result} =
Pleroma.Repo.transaction(fn ->
liked_object = Object.get_by_ap_id(object.data["object"])
Utils.add_like_to_object(object, liked_object)
liked_object = Object.get_by_ap_id(object.data["object"])
Utils.add_like_to_object(object, liked_object)
Notification.create_notifications(object)
Notification.create_notifications(object)
{:ok, object, meta}
end)
result
{:ok, object, meta}
end
# Tasks this handles

View file

@ -16,7 +16,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
alias Pleroma.Web.ActivityPub.ObjectValidator
alias Pleroma.Web.ActivityPub.ObjectValidators.LikeValidator
alias Pleroma.Web.ActivityPub.Pipeline
alias Pleroma.Web.ActivityPub.Transmogrifier.ChatMessageHandling
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.Visibility
alias Pleroma.Web.Federator
@ -646,9 +645,16 @@ def handle_incoming(
def handle_incoming(
%{"type" => "Create", "object" => %{"type" => "ChatMessage"}} = data,
options
),
do: ChatMessageHandling.handle_incoming(data, options)
_options
) do
case Pipeline.common_pipeline(data, local: false) do
{:ok, activity, _} ->
{:ok, activity}
e ->
e
end
end
def handle_incoming(%{"type" => "Like"} = data, _options) do
with {_, {:ok, cast_data_sym}} <-

View file

@ -1,20 +0,0 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Transmogrifier.ChatMessageHandling do
alias Pleroma.Web.ActivityPub.Pipeline
def handle_incoming(
%{"type" => "Create", "object" => %{"type" => "ChatMessage"}} = data,
_options
) do
case Pipeline.common_pipeline(data, local: false) do
{:ok, activity, _} ->
{:ok, activity}
e ->
e
end
end
end