commit: 082319ff482f82c72b633e88dbe06c06205f4faf
parent cbc5e4841725a19761f5d869e2cc8f5152692791
Author: Mark Felder <feld@feld.me>
Date: Mon, 22 Jul 2024 18:44:32 -0400
Fix order of args for unblock/2
Diffstat:
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex
@@ -100,7 +100,7 @@ defmodule Pleroma.Web.CommonAPI do
end
@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)},
{:ok, unblock_data, _} <- Builder.undo(blocker, block),
{:ok, unblock, _} <- Pipeline.common_pipeline(unblock_data, local: true) do
diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
@@ -504,7 +504,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
@doc "POST /api/v1/accounts/:id/unblock"
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)
else
{:error, message} -> json_response(conn, :forbidden, %{error: message})
diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs
@@ -324,7 +324,7 @@ defmodule Pleroma.Web.CommonAPITest do
User.block(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)
end
end