Transmogrifier: Switch to pipeline for Blocks.

This commit is contained in:
lain 2020-06-25 11:33:54 +02:00
commit e38293c8f1
3 changed files with 45 additions and 18 deletions

View file

@ -20,6 +20,22 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
def handle(object, meta \\ [])
# Tasks this handles:
# - Unfollow and block
def handle(
%{data: %{"type" => "Block", "object" => blocked_user, "actor" => blocking_user}} =
object,
meta
) do
with %User{} = blocker <- User.get_cached_by_ap_id(blocking_user),
%User{} = blocked <- User.get_cached_by_ap_id(blocked_user) do
User.unfollow(blocker, blocked)
User.block(blocker, blocked)
end
{:ok, object, meta}
end
# Tasks this handles:
# - Update the user
#