mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-28 00:25:25 +00:00
Merge branch 'feature/mastodon-s2s-block-opt-out' into 'develop'
activitypub: allow mastodon S2S block extension support to be disabled See merge request pleroma/pleroma!176
This commit is contained in:
commit
e1fe46e1cf
|
@ -56,6 +56,8 @@ config :pleroma, :instance,
|
||||||
rewrite_policy: Pleroma.Web.ActivityPub.MRF.NoOpPolicy,
|
rewrite_policy: Pleroma.Web.ActivityPub.MRF.NoOpPolicy,
|
||||||
public: true
|
public: true
|
||||||
|
|
||||||
|
config :pleroma, :activitypub, accept_blocks: true
|
||||||
|
|
||||||
config :pleroma, :mrf_simple,
|
config :pleroma, :mrf_simple,
|
||||||
media_removal: [],
|
media_removal: [],
|
||||||
media_nsfw: [],
|
media_nsfw: [],
|
||||||
|
|
|
@ -259,6 +259,9 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ap_config Application.get_env(:pleroma, :activitypub)
|
||||||
|
@accept_blocks Keyword.get(@ap_config, :accept_blocks)
|
||||||
|
|
||||||
def handle_incoming(
|
def handle_incoming(
|
||||||
%{
|
%{
|
||||||
"type" => "Undo",
|
"type" => "Undo",
|
||||||
|
@ -267,7 +270,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
"id" => id
|
"id" => id
|
||||||
} = _data
|
} = _data
|
||||||
) do
|
) do
|
||||||
with %User{local: true} = blocked <- User.get_cached_by_ap_id(blocked),
|
with true <- @accept_blocks,
|
||||||
|
%User{local: true} = blocked <- User.get_cached_by_ap_id(blocked),
|
||||||
%User{} = blocker <- User.get_or_fetch_by_ap_id(blocker),
|
%User{} = blocker <- User.get_or_fetch_by_ap_id(blocker),
|
||||||
{:ok, activity} <- ActivityPub.unblock(blocker, blocked, id, false) do
|
{:ok, activity} <- ActivityPub.unblock(blocker, blocked, id, false) do
|
||||||
User.unblock(blocker, blocked)
|
User.unblock(blocker, blocked)
|
||||||
|
@ -280,7 +284,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
def handle_incoming(
|
def handle_incoming(
|
||||||
%{"type" => "Block", "object" => blocked, "actor" => blocker, "id" => id} = data
|
%{"type" => "Block", "object" => blocked, "actor" => blocker, "id" => id} = data
|
||||||
) do
|
) do
|
||||||
with %User{local: true} = blocked = User.get_cached_by_ap_id(blocked),
|
with true <- @accept_blocks,
|
||||||
|
%User{local: true} = blocked = User.get_cached_by_ap_id(blocked),
|
||||||
%User{} = blocker = User.get_or_fetch_by_ap_id(blocker),
|
%User{} = blocker = User.get_or_fetch_by_ap_id(blocker),
|
||||||
{:ok, activity} <- ActivityPub.block(blocker, blocked, id, false) do
|
{:ok, activity} <- ActivityPub.block(blocker, blocked, id, false) do
|
||||||
User.unfollow(blocker, blocked)
|
User.unfollow(blocker, blocked)
|
||||||
|
|
Loading…
Reference in a new issue