Fix CommonAPI.follow/2 which returned users in the reverse order they were provided to the function

This commit is contained in:
Mark Felder 2024-08-07 12:37:58 -04:00
commit 06e8ece4cc
9 changed files with 31 additions and 31 deletions

View file

@ -493,7 +493,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
user = insert(:user)
other_user = insert(:user, is_locked: true)
{:ok, user, other_user, _} = CommonAPI.follow(other_user, user)
{:ok, other_user, user, _} = CommonAPI.follow(other_user, user)
user = User.get_cached_by_id(user.id)
other_user = User.get_cached_by_id(other_user.id)
@ -560,8 +560,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
test "shows when follows/followers are hidden" do
user = insert(:user, hide_followers: true, hide_follows: true)
other_user = insert(:user)
{:ok, user, other_user, _activity} = CommonAPI.follow(other_user, user)
{:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
{:ok, other_user, user, _activity} = CommonAPI.follow(other_user, user)
{:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{
followers_count: 1,
@ -573,11 +573,11 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
test "shows actual follower/following count to the account owner" do
user = insert(:user, hide_followers: true, hide_follows: true)
other_user = insert(:user)
{:ok, user, other_user, _activity} = CommonAPI.follow(other_user, user)
{:ok, other_user, user, _activity} = CommonAPI.follow(other_user, user)
assert User.following?(user, other_user)
assert Pleroma.FollowingRelationship.follower_count(other_user) == 1
{:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
{:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{
followers_count: 1,
@ -696,7 +696,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
{:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
{:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{locked: true, follow_requests_count: 1} =
AccountView.render("show.json", %{user: user, for: user})
@ -708,7 +708,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
{:ok, other_user, user, _activity} = CommonAPI.follow(user, other_user)
{:ok, user, other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{locked: true, follow_requests_count: 1} =
AccountView.render("show.json", %{user: user, for: user})
@ -725,7 +725,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
{:ok, other_user, user, _activity} = CommonAPI.follow(user, other_user)
{:ok, user, other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{locked: true, follow_requests_count: 1} =
AccountView.render("show.json", %{user: user, for: user})
@ -742,7 +742,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
{:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
{:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
{:ok, user} = User.update_and_set_cache(user, %{is_locked: false})

View file

@ -132,7 +132,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
test "Follow notification" do
follower = insert(:user)
followed = insert(:user)
{:ok, follower, followed, _activity} = CommonAPI.follow(followed, follower)
{:ok, followed, follower, _activity} = CommonAPI.follow(followed, follower)
notification = Notification |> Repo.one() |> Repo.preload(:activity)
expected = %{