Merge branch 'feature/configurable-blocks' into 'develop'
Add more configurability to how blocks work See merge request pleroma/pleroma!203
This commit is contained in:
commit
dfc96f222c
4 changed files with 45 additions and 7 deletions
|
|
@ -251,16 +251,25 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
end
|
||||
|
||||
def block(blocker, blocked, activity_id \\ nil, local \\ true) do
|
||||
follow_activity = fetch_latest_follow(blocker, blocked)
|
||||
ap_config = Application.get_env(:pleroma, :activitypub)
|
||||
unfollow_blocked = Keyword.get(ap_config, :unfollow_blocked)
|
||||
outgoing_blocks = Keyword.get(ap_config, :outgoing_blocks)
|
||||
|
||||
if follow_activity do
|
||||
unfollow(blocker, blocked, nil, local)
|
||||
with true <- unfollow_blocked do
|
||||
follow_activity = fetch_latest_follow(blocker, blocked)
|
||||
|
||||
if follow_activity do
|
||||
unfollow(blocker, blocked, nil, local)
|
||||
end
|
||||
end
|
||||
|
||||
with block_data <- make_block_data(blocker, blocked, activity_id),
|
||||
with true <- outgoing_blocks,
|
||||
block_data <- make_block_data(blocker, blocked, activity_id),
|
||||
{:ok, activity} <- insert(block_data, local),
|
||||
:ok <- maybe_federate(activity) do
|
||||
{:ok, activity}
|
||||
else
|
||||
_e -> {:ok, nil}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue