forked from AkkomaGang/akkoma
Transmogrifier: Remove ChatMessageHandling module.
This commit is contained in:
parent
e055b8d203
commit
53e3063bd0
3 changed files with 14 additions and 33 deletions
|
@ -19,17 +19,12 @@ def handle(object, meta \\ [])
|
||||||
# - Add like to object
|
# - Add like to object
|
||||||
# - Set up notification
|
# - Set up notification
|
||||||
def handle(%{data: %{"type" => "Like"}} = object, meta) do
|
def handle(%{data: %{"type" => "Like"}} = object, meta) do
|
||||||
{:ok, result} =
|
liked_object = Object.get_by_ap_id(object.data["object"])
|
||||||
Pleroma.Repo.transaction(fn ->
|
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}
|
{:ok, object, meta}
|
||||||
end)
|
|
||||||
|
|
||||||
result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tasks this handles
|
# Tasks this handles
|
||||||
|
|
|
@ -16,7 +16,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
alias Pleroma.Web.ActivityPub.ObjectValidator
|
alias Pleroma.Web.ActivityPub.ObjectValidator
|
||||||
alias Pleroma.Web.ActivityPub.ObjectValidators.LikeValidator
|
alias Pleroma.Web.ActivityPub.ObjectValidators.LikeValidator
|
||||||
alias Pleroma.Web.ActivityPub.Pipeline
|
alias Pleroma.Web.ActivityPub.Pipeline
|
||||||
alias Pleroma.Web.ActivityPub.Transmogrifier.ChatMessageHandling
|
|
||||||
alias Pleroma.Web.ActivityPub.Utils
|
alias Pleroma.Web.ActivityPub.Utils
|
||||||
alias Pleroma.Web.ActivityPub.Visibility
|
alias Pleroma.Web.ActivityPub.Visibility
|
||||||
alias Pleroma.Web.Federator
|
alias Pleroma.Web.Federator
|
||||||
|
@ -646,9 +645,16 @@ def handle_incoming(
|
||||||
|
|
||||||
def handle_incoming(
|
def handle_incoming(
|
||||||
%{"type" => "Create", "object" => %{"type" => "ChatMessage"}} = data,
|
%{"type" => "Create", "object" => %{"type" => "ChatMessage"}} = data,
|
||||||
options
|
_options
|
||||||
),
|
) do
|
||||||
do: ChatMessageHandling.handle_incoming(data, options)
|
case Pipeline.common_pipeline(data, local: false) do
|
||||||
|
{:ok, activity, _} ->
|
||||||
|
{:ok, activity}
|
||||||
|
|
||||||
|
e ->
|
||||||
|
e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def handle_incoming(%{"type" => "Like"} = data, _options) do
|
def handle_incoming(%{"type" => "Like"} = data, _options) do
|
||||||
with {_, {:ok, cast_data_sym}} <-
|
with {_, {:ok, cast_data_sym}} <-
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in a new issue