Fix order of args for hide_reblogs/2

This commit is contained in:
Mark Felder 2024-07-22 19:16:00 -04:00
parent adb93f7e5d
commit 3f4f567c9c
6 changed files with 10 additions and 10 deletions

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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(

View file

@ -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)