Fix order of args for unblock/2

This commit is contained in:
Mark Felder 2024-07-22 18:44:32 -04:00
parent cbc5e48417
commit 082319ff48
3 changed files with 3 additions and 3 deletions

View File

@ -100,7 +100,7 @@ defmodule Pleroma.Web.CommonAPI 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

View File

@ -504,7 +504,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController 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})

View File

@ -324,7 +324,7 @@ defmodule Pleroma.Web.CommonAPITest 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