From 3f4f567c9cbc0182eb99ec951a6088bfc5bb57d5 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 22 Jul 2024 19:16:00 -0400 Subject: [PATCH] Fix order of args for hide_reblogs/2 --- lib/pleroma/web/common_api.ex | 2 +- lib/pleroma/web/mastodon_api/mastodon_api.ex | 2 +- test/pleroma/web/activity_pub/activity_pub_test.exs | 4 ++-- test/pleroma/web/common_api_test.exs | 4 ++-- test/pleroma/web/mastodon_api/views/account_view_test.exs | 2 +- test/pleroma/web/streamer_test.exs | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index 827710c11..13d738310 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -687,7 +687,7 @@ defmodule Pleroma.Web.CommonAPI do defp set_visibility(activity, _), do: {:ok, activity} @spec hide_reblogs(User.t(), User.t()) :: {:ok, any()} | {:error, any()} - def hide_reblogs(%User{} = user, %User{} = target) do + def hide_reblogs(%User{} = target, %User{} = user) do UserRelationship.create_reblog_mute(user, target) end diff --git a/lib/pleroma/web/mastodon_api/mastodon_api.ex b/lib/pleroma/web/mastodon_api/mastodon_api.ex index a382e2826..c6243d654 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api.ex @@ -30,7 +30,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPI do end defp set_reblogs_visibility(false, {:ok, follower, followed, _}) do - CommonAPI.hide_reblogs(follower, followed) + CommonAPI.hide_reblogs(followed, follower) end defp set_reblogs_visibility(_, {:ok, follower, followed, _}) do diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 164f42480..4ec453127 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -1358,7 +1358,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do activity = insert(:note_activity) user = insert(:user) booster = insert(:user) - {:ok, _reblog_mute} = CommonAPI.hide_reblogs(user, booster) + {:ok, _reblog_mute} = CommonAPI.hide_reblogs(booster, user) {:ok, activity} = CommonAPI.repeat(activity.id, booster) @@ -1371,7 +1371,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do activity = insert(:note_activity) user = insert(:user) booster = insert(:user) - {:ok, _reblog_mute} = CommonAPI.hide_reblogs(user, booster) + {:ok, _reblog_mute} = CommonAPI.hide_reblogs(booster, user) {:ok, _reblog_mute} = CommonAPI.show_reblogs(user, booster) {:ok, activity} = CommonAPI.repeat(activity.id, booster) diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index c1b825d93..e0fb6d63d 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -1404,13 +1404,13 @@ defmodule Pleroma.Web.CommonAPITest do end test "add a reblog mute", %{muter: muter, muted: muted} do - {:ok, _reblog_mute} = CommonAPI.hide_reblogs(muter, muted) + {:ok, _reblog_mute} = CommonAPI.hide_reblogs(muted, muter) assert User.showing_reblogs?(muter, muted) == false end test "remove a reblog mute", %{muter: muter, muted: muted} do - {:ok, _reblog_mute} = CommonAPI.hide_reblogs(muter, muted) + {:ok, _reblog_mute} = CommonAPI.hide_reblogs(muted, muter) {:ok, _reblog_mute} = CommonAPI.show_reblogs(muter, muted) assert User.showing_reblogs?(muter, muted) == true diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index 30f8eea5b..f0711fa0d 100644 --- a/test/pleroma/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -436,7 +436,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do {:ok, other_user, user} = User.follow(other_user, user) {:ok, _subscription} = User.subscribe(user, other_user) {:ok, _user_relationships} = User.mute(user, other_user, %{notifications: true}) - {:ok, _reblog_mute} = CommonAPI.hide_reblogs(user, other_user) + {:ok, _reblog_mute} = CommonAPI.hide_reblogs(other_user, user) expected = Map.merge( diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs index b6f30eb7c..262ff11d2 100644 --- a/test/pleroma/web/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs @@ -827,7 +827,7 @@ defmodule Pleroma.Web.StreamerTest do user2 = insert(:user) user3 = insert(:user) CommonAPI.follow(user2, user1) - CommonAPI.hide_reblogs(user1, user2) + CommonAPI.hide_reblogs(user2, user1) {:ok, create_activity} = CommonAPI.post(user3, %{status: "I'm kawen"}) @@ -843,7 +843,7 @@ defmodule Pleroma.Web.StreamerTest do } do user2 = insert(:user) CommonAPI.follow(user2, user1) - CommonAPI.hide_reblogs(user1, user2) + CommonAPI.hide_reblogs(user2, user1) {:ok, create_activity} = CommonAPI.post(user1, %{status: "I'm kawen"}) Streamer.get_topic_and_add_socket("user", user1, user1_token) @@ -859,7 +859,7 @@ defmodule Pleroma.Web.StreamerTest do } do user2 = insert(:user) CommonAPI.follow(user2, user1) - CommonAPI.hide_reblogs(user1, user2) + CommonAPI.hide_reblogs(user2, user1) {:ok, create_activity} = CommonAPI.post(user1, %{status: "I'm kawen"}) Streamer.get_topic_and_add_socket("user", user1, user1_token)