CommonAPI: Unblock a user even if we don't have an activity.
This commit is contained in:
parent
aeacfb2479
commit
2dcb26a6e5
2 changed files with 24 additions and 1 deletions
|
|
@ -25,10 +25,21 @@ defmodule Pleroma.Web.CommonAPI do
|
|||
require Logger
|
||||
|
||||
def unblock(blocker, blocked) do
|
||||
with %Activity{} = block <- Utils.fetch_latest_block(blocker, blocked),
|
||||
with {_, %Activity{} = block} <- {:fetch_block, Utils.fetch_latest_block(blocker, blocked)},
|
||||
{:ok, unblock_data, _} <- Builder.undo(blocker, block),
|
||||
{:ok, unblock, _} <- Pipeline.common_pipeline(unblock_data, local: true) do
|
||||
{:ok, unblock}
|
||||
else
|
||||
{:fetch_block, nil} ->
|
||||
if User.blocks?(blocker, blocked) do
|
||||
User.unblock(blocker, blocked)
|
||||
{:ok, :no_activity}
|
||||
else
|
||||
{:error, :not_blocking}
|
||||
end
|
||||
|
||||
e ->
|
||||
e
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue