Fix order of args for unblock/2
This commit is contained in:
parent
cbc5e48417
commit
082319ff48
3 changed files with 3 additions and 3 deletions
|
@ -100,7 +100,7 @@ defp validate_chat_content_length(content, _) do
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec unblock(User.t(), User.t()) :: {:ok, Activity.t()} | {:error, any()}
|
@spec unblock(User.t(), User.t()) :: {:ok, Activity.t()} | {:error, any()}
|
||||||
def unblock(blocker, blocked) do
|
def unblock(blocked, blocker) do
|
||||||
with {_, %Activity{} = block} <- {:fetch_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_data, _} <- Builder.undo(blocker, block),
|
||||||
{:ok, unblock, _} <- Pipeline.common_pipeline(unblock_data, local: true) do
|
{:ok, unblock, _} <- Pipeline.common_pipeline(unblock_data, local: true) do
|
||||||
|
|
|
@ -504,7 +504,7 @@ def block(%{assigns: %{user: blocker, account: blocked}} = conn, _params) do
|
||||||
|
|
||||||
@doc "POST /api/v1/accounts/:id/unblock"
|
@doc "POST /api/v1/accounts/:id/unblock"
|
||||||
def unblock(%{assigns: %{user: blocker, account: blocked}} = conn, _params) do
|
def unblock(%{assigns: %{user: blocker, account: blocked}} = conn, _params) do
|
||||||
with {:ok, _activity} <- CommonAPI.unblock(blocker, blocked) do
|
with {:ok, _activity} <- CommonAPI.unblock(blocked, blocker) do
|
||||||
render(conn, "relationship.json", user: blocker, target: blocked)
|
render(conn, "relationship.json", user: blocker, target: blocked)
|
||||||
else
|
else
|
||||||
{:error, message} -> json_response(conn, :forbidden, %{error: message})
|
{:error, message} -> json_response(conn, :forbidden, %{error: message})
|
||||||
|
|
|
@ -324,7 +324,7 @@ test "it works even without an existing block activity" do
|
||||||
User.block(blocker, blocked)
|
User.block(blocker, blocked)
|
||||||
|
|
||||||
assert User.blocks?(blocker, blocked)
|
assert User.blocks?(blocker, blocked)
|
||||||
assert {:ok, :no_activity} == CommonAPI.unblock(blocker, blocked)
|
assert {:ok, :no_activity} == CommonAPI.unblock(blocked, blocker)
|
||||||
refute User.blocks?(blocker, blocked)
|
refute User.blocks?(blocker, blocked)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue