Fix order of args for hide_reblogs/2
This commit is contained in:
parent
adb93f7e5d
commit
3f4f567c9c
@ -687,7 +687,7 @@ defmodule Pleroma.Web.CommonAPI do
|
|||||||
defp set_visibility(activity, _), do: {:ok, activity}
|
defp set_visibility(activity, _), do: {:ok, activity}
|
||||||
|
|
||||||
@spec hide_reblogs(User.t(), User.t()) :: {:ok, any()} | {:error, any()}
|
@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)
|
UserRelationship.create_reblog_mute(user, target)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPI do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defp set_reblogs_visibility(false, {:ok, follower, followed, _}) do
|
defp set_reblogs_visibility(false, {:ok, follower, followed, _}) do
|
||||||
CommonAPI.hide_reblogs(follower, followed)
|
CommonAPI.hide_reblogs(followed, follower)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp set_reblogs_visibility(_, {:ok, follower, followed, _}) do
|
defp set_reblogs_visibility(_, {:ok, follower, followed, _}) do
|
||||||
|
@ -1358,7 +1358,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||||||
activity = insert(:note_activity)
|
activity = insert(:note_activity)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
booster = 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)
|
{:ok, activity} = CommonAPI.repeat(activity.id, booster)
|
||||||
|
|
||||||
@ -1371,7 +1371,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||||||
activity = insert(:note_activity)
|
activity = insert(:note_activity)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
booster = 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, _reblog_mute} = CommonAPI.show_reblogs(user, booster)
|
||||||
|
|
||||||
{:ok, activity} = CommonAPI.repeat(activity.id, booster)
|
{:ok, activity} = CommonAPI.repeat(activity.id, booster)
|
||||||
|
@ -1404,13 +1404,13 @@ defmodule Pleroma.Web.CommonAPITest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "add a reblog mute", %{muter: muter, muted: muted} do
|
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
|
assert User.showing_reblogs?(muter, muted) == false
|
||||||
end
|
end
|
||||||
|
|
||||||
test "remove a reblog mute", %{muter: muter, muted: muted} do
|
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)
|
{:ok, _reblog_mute} = CommonAPI.show_reblogs(muter, muted)
|
||||||
|
|
||||||
assert User.showing_reblogs?(muter, muted) == true
|
assert User.showing_reblogs?(muter, muted) == true
|
||||||
|
@ -436,7 +436,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||||||
{:ok, other_user, user} = User.follow(other_user, user)
|
{:ok, other_user, user} = User.follow(other_user, user)
|
||||||
{:ok, _subscription} = User.subscribe(user, other_user)
|
{:ok, _subscription} = User.subscribe(user, other_user)
|
||||||
{:ok, _user_relationships} = User.mute(user, other_user, %{notifications: true})
|
{: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 =
|
expected =
|
||||||
Map.merge(
|
Map.merge(
|
||||||
|
@ -827,7 +827,7 @@ defmodule Pleroma.Web.StreamerTest do
|
|||||||
user2 = insert(:user)
|
user2 = insert(:user)
|
||||||
user3 = insert(:user)
|
user3 = insert(:user)
|
||||||
CommonAPI.follow(user2, user1)
|
CommonAPI.follow(user2, user1)
|
||||||
CommonAPI.hide_reblogs(user1, user2)
|
CommonAPI.hide_reblogs(user2, user1)
|
||||||
|
|
||||||
{:ok, create_activity} = CommonAPI.post(user3, %{status: "I'm kawen"})
|
{:ok, create_activity} = CommonAPI.post(user3, %{status: "I'm kawen"})
|
||||||
|
|
||||||
@ -843,7 +843,7 @@ defmodule Pleroma.Web.StreamerTest do
|
|||||||
} do
|
} do
|
||||||
user2 = insert(:user)
|
user2 = insert(:user)
|
||||||
CommonAPI.follow(user2, user1)
|
CommonAPI.follow(user2, user1)
|
||||||
CommonAPI.hide_reblogs(user1, user2)
|
CommonAPI.hide_reblogs(user2, user1)
|
||||||
|
|
||||||
{:ok, create_activity} = CommonAPI.post(user1, %{status: "I'm kawen"})
|
{:ok, create_activity} = CommonAPI.post(user1, %{status: "I'm kawen"})
|
||||||
Streamer.get_topic_and_add_socket("user", user1, user1_token)
|
Streamer.get_topic_and_add_socket("user", user1, user1_token)
|
||||||
@ -859,7 +859,7 @@ defmodule Pleroma.Web.StreamerTest do
|
|||||||
} do
|
} do
|
||||||
user2 = insert(:user)
|
user2 = insert(:user)
|
||||||
CommonAPI.follow(user2, user1)
|
CommonAPI.follow(user2, user1)
|
||||||
CommonAPI.hide_reblogs(user1, user2)
|
CommonAPI.hide_reblogs(user2, user1)
|
||||||
|
|
||||||
{:ok, create_activity} = CommonAPI.post(user1, %{status: "I'm kawen"})
|
{:ok, create_activity} = CommonAPI.post(user1, %{status: "I'm kawen"})
|
||||||
Streamer.get_topic_and_add_socket("user", user1, user1_token)
|
Streamer.get_topic_and_add_socket("user", user1, user1_token)
|
||||||
|
Loading…
Reference in New Issue
Block a user