commit: f79a16c062a14634d8b5f90e08df0b22b799bb45
parent 082319ff482f82c72b633e88dbe06c06205f4faf
Author: Mark Felder <feld@feld.me>
Date: Mon, 22 Jul 2024 19:07:55 -0400
Fix order of args for follow/2
Diffstat:
34 files changed, 119 insertions(+), 119 deletions(-)
diff --git a/lib/pleroma/following_relationship.ex b/lib/pleroma/following_relationship.ex
@@ -199,7 +199,7 @@ defmodule Pleroma.FollowingRelationship do
|> preload([:follower])
|> Repo.all()
|> Enum.map(fn following_relationship ->
- Pleroma.Web.CommonAPI.follow(following_relationship.follower, target)
+ Pleroma.Web.CommonAPI.follow(target, following_relationship.follower)
Pleroma.Web.CommonAPI.unfollow(following_relationship.follower, origin)
end)
|> case do
diff --git a/lib/pleroma/user/import.ex b/lib/pleroma/user/import.ex
@@ -46,7 +46,7 @@ defmodule Pleroma.User.Import do
fn identifier ->
with {:ok, %User{} = followed} <- User.get_or_fetch(identifier),
{:ok, follower, followed} <- User.maybe_direct_follow(follower, followed),
- {:ok, _, _, _} <- CommonAPI.follow(follower, followed) do
+ {:ok, _, _, _} <- CommonAPI.follow(followed, follower) do
followed
else
error -> handle_error(:follow_import, identifier, error)
diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex
@@ -49,7 +49,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do
"#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}"
)
- CommonAPI.follow(follower, user)
+ CommonAPI.follow(user, follower)
end
end)
diff --git a/lib/pleroma/web/activity_pub/relay.ex b/lib/pleroma/web/activity_pub/relay.ex
@@ -22,7 +22,7 @@ defmodule Pleroma.Web.ActivityPub.Relay do
def follow(target_instance) do
with %User{} = local_user <- get_actor(),
{:ok, %User{} = target_user} <- User.get_or_fetch_by_ap_id(target_instance),
- {:ok, _, _, activity} <- CommonAPI.follow(local_user, target_user) do
+ {:ok, _, _, activity} <- CommonAPI.follow(target_user, local_user) do
Logger.info("relay: followed instance: #{target_instance}; id=#{activity.data["id"]}")
{:ok, activity}
else
diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex
@@ -121,7 +121,7 @@ defmodule Pleroma.Web.CommonAPI do
@spec follow(User.t(), User.t()) ::
{:ok, User.t(), User.t(), Activity.t() | Object.t()} | {:error, :rejected}
- def follow(follower, followed) do
+ def follow(followed, follower) do
timeout = Pleroma.Config.get([:activitypub, :follow_handshake_timeout])
with {:ok, follow_data, _} <- Builder.follow(follower, followed),
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api.ex b/lib/pleroma/web/mastodon_api/mastodon_api.ex
@@ -16,7 +16,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPI do
def follow(follower, followed, params \\ %{}) do
result =
if not User.following?(follower, followed) do
- CommonAPI.follow(follower, followed)
+ CommonAPI.follow(followed, follower)
else
{:ok, follower, followed, nil}
end
diff --git a/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex b/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex
@@ -73,7 +73,7 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowController do
#
def do_follow(%{assigns: %{user: %User{} = user}} = conn, %{"user" => %{"id" => id}}) do
with {:fetch_user, %User{} = followee} <- {:fetch_user, User.get_cached_by_id(id)},
- {:ok, _, _, _} <- CommonAPI.follow(user, followee) do
+ {:ok, _, _, _} <- CommonAPI.follow(followee, user) do
redirect(conn, to: "/users/#{followee.id}")
else
error ->
@@ -90,7 +90,7 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowController do
with {_, %User{} = followee} <- {:fetch_user, User.get_cached_by_id(id)},
{_, {:ok, user}, _} <- {:auth, WrapperAuthenticator.get_user(conn), followee},
{_, _, _, false} <- {:mfa_required, followee, user, MFA.require?(user)},
- {:ok, _, _, _} <- CommonAPI.follow(user, followee) do
+ {:ok, _, _, _} <- CommonAPI.follow(followee, user) do
redirect(conn, to: "/users/#{followee.id}")
else
error ->
@@ -108,7 +108,7 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowController do
{_, _, {:ok, %{user: user}}} <- {:mfa_token, followee, MFA.Token.validate(token)},
{_, _, _, {:ok, _}} <-
{:verify_mfa_code, followee, token, TOTPAuthenticator.verify(code, user)},
- {:ok, _, _, _} <- CommonAPI.follow(user, followee) do
+ {:ok, _, _, _} <- CommonAPI.follow(followee, user) do
redirect(conn, to: "/users/#{followee.id}")
else
error ->
diff --git a/test/pleroma/integration/mastodon_websocket_test.exs b/test/pleroma/integration/mastodon_websocket_test.exs
@@ -404,7 +404,7 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
test "receives private statuses", %{user: reading_user, token: token} do
user = insert(:user)
- CommonAPI.follow(reading_user, user)
+ CommonAPI.follow(user, reading_user)
{:ok, _} = start_socket("?stream=user&access_token=#{token.token}")
@@ -431,7 +431,7 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
test "receives edits", %{user: reading_user, token: token} do
user = insert(:user)
- CommonAPI.follow(reading_user, user)
+ CommonAPI.follow(user, reading_user)
{:ok, _} = start_socket("?stream=user&access_token=#{token.token}")
@@ -459,7 +459,7 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
test "receives notifications", %{user: reading_user, token: token} do
user = insert(:user)
- CommonAPI.follow(reading_user, user)
+ CommonAPI.follow(user, reading_user)
{:ok, _} = start_socket("?stream=user:notification&access_token=#{token.token}")
diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs
@@ -209,7 +209,7 @@ defmodule Pleroma.NotificationTest do
notification_settings: %Pleroma.User.NotificationSetting{block_from_strangers: true}
)
- CommonAPI.follow(follower, followed)
+ CommonAPI.follow(followed, follower)
{:ok, activity} = CommonAPI.post(follower, %{status: "hey @#{followed.nickname}"})
refute Notification.create_notification(activity, followed)
end
@@ -222,7 +222,7 @@ defmodule Pleroma.NotificationTest do
notification_settings: %Pleroma.User.NotificationSetting{block_from_strangers: true}
)
- CommonAPI.follow(receiver, poster)
+ CommonAPI.follow(poster, receiver)
{:ok, activity} = CommonAPI.post(poster, %{status: "hey @#{receiver.nickname}"})
assert Notification.create_notification(activity, receiver)
end
@@ -238,7 +238,7 @@ defmodule Pleroma.NotificationTest do
user = insert(:user)
subscriber = insert(:user)
- {:ok, _, _, _} = CommonAPI.follow(subscriber, user)
+ {:ok, _, _, _} = CommonAPI.follow(user, subscriber)
User.subscribe(subscriber, user)
{:ok, status} = CommonAPI.post(user, %{status: "Akariiiin"})
{:ok, [_notif]} = Notification.create_notifications(status)
@@ -309,7 +309,7 @@ defmodule Pleroma.NotificationTest do
user = insert(:user)
followed_user = insert(:user, is_locked: false)
- {:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
+ {:ok, _, _, _activity} = CommonAPI.follow(followed_user, user)
assert FollowingRelationship.following?(user, followed_user)
assert [notification] = Notification.for_user(followed_user)
@@ -324,7 +324,7 @@ defmodule Pleroma.NotificationTest do
user = insert(:user)
followed_user = insert(:user, is_locked: true)
- {:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
+ {:ok, _, _, _activity} = CommonAPI.follow(followed_user, user)
refute FollowingRelationship.following?(user, followed_user)
assert [notification] = Notification.for_user(followed_user)
@@ -349,12 +349,12 @@ defmodule Pleroma.NotificationTest do
user = insert(:user)
followed_user = insert(:user, is_locked: false)
- {:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
+ {:ok, _, _, _activity} = CommonAPI.follow(followed_user, user)
assert FollowingRelationship.following?(user, followed_user)
assert [notification] = Notification.for_user(followed_user)
CommonAPI.unfollow(user, followed_user)
- {:ok, _, _, _activity_dupe} = CommonAPI.follow(user, followed_user)
+ {:ok, _, _, _activity_dupe} = CommonAPI.follow(followed_user, user)
notification_id = notification.id
assert [%{id: ^notification_id}] = Notification.for_user(followed_user)
@@ -363,7 +363,7 @@ defmodule Pleroma.NotificationTest do
test "dismisses the notification on follow request rejection" do
user = insert(:user, is_locked: true)
follower = insert(:user)
- {:ok, _, _, _follow_activity} = CommonAPI.follow(follower, user)
+ {:ok, _, _, _follow_activity} = CommonAPI.follow(user, follower)
assert [_notification] = Notification.for_user(user)
{:ok, _follower} = CommonAPI.reject_follow_request(follower, user)
assert [] = Notification.for_user(user)
@@ -1101,7 +1101,7 @@ defmodule Pleroma.NotificationTest do
insert(:filter, user: followed_user, phrase: "test", hide: true)
- {:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
+ {:ok, _, _, _activity} = CommonAPI.follow(followed_user, user)
refute FollowingRelationship.following?(user, followed_user)
assert [notification] = Notification.for_user(followed_user)
diff --git a/test/pleroma/stats_test.exs b/test/pleroma/stats_test.exs
@@ -73,7 +73,7 @@ defmodule Pleroma.StatsTest do
user = insert(:user)
other_user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{visibility: "public", status: "hey"})
- _ = CommonAPI.follow(user, other_user)
+ _ = CommonAPI.follow(other_user, user)
CommonAPI.favorite(activity.id, other_user)
CommonAPI.repeat(activity.id, other_user)
diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs
@@ -183,7 +183,7 @@ defmodule Pleroma.User.BackupTest do
Bookmark.create(user.id, status2.id)
Bookmark.create(user.id, status3.id)
- CommonAPI.follow(user, other_user)
+ CommonAPI.follow(other_user, user)
assert {:ok, backup} = user |> Backup.new() |> Repo.insert()
assert {:ok, path} = Backup.export(backup, self())
diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs
@@ -182,8 +182,8 @@ defmodule Pleroma.UserTest do
locked = insert(:user, is_locked: true)
follower = insert(:user)
- CommonAPI.follow(follower, unlocked)
- CommonAPI.follow(follower, locked)
+ CommonAPI.follow(unlocked, follower)
+ CommonAPI.follow(locked, follower)
assert [] = User.get_follow_requests(unlocked)
assert [activity] = User.get_follow_requests(locked)
@@ -196,9 +196,9 @@ defmodule Pleroma.UserTest do
pending_follower = insert(:user)
accepted_follower = insert(:user)
- CommonAPI.follow(pending_follower, locked)
- CommonAPI.follow(pending_follower, locked)
- CommonAPI.follow(accepted_follower, locked)
+ CommonAPI.follow(locked, pending_follower)
+ CommonAPI.follow(locked, pending_follower)
+ CommonAPI.follow(locked, accepted_follower)
Pleroma.FollowingRelationship.update(accepted_follower, locked, :follow_accept)
@@ -209,7 +209,7 @@ defmodule Pleroma.UserTest do
locked = insert(:user, is_locked: true)
pending_follower = insert(:user, %{is_active: false})
- CommonAPI.follow(pending_follower, locked)
+ CommonAPI.follow(locked, pending_follower)
refute pending_follower.is_active
assert [] = User.get_follow_requests(locked)
@@ -219,7 +219,7 @@ defmodule Pleroma.UserTest do
followed = insert(:user, is_locked: true)
follower = insert(:user)
- CommonAPI.follow(follower, followed)
+ CommonAPI.follow(followed, follower)
assert [_activity] = User.get_follow_requests(followed)
{:ok, _user_relationship} = User.block(followed, follower)
diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
@@ -1747,7 +1747,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
%{conn: conn} do
user = insert(:user, hide_followers: true)
other_user = insert(:user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
result =
conn
@@ -1843,7 +1843,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
%{conn: conn} do
user = insert(:user, hide_follows: true)
other_user = insert(:user)
- {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(other_user, user)
result =
conn
diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs
@@ -1038,7 +1038,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
refute activity in activities
followed_user = insert(:user)
- CommonAPI.follow(user, followed_user)
+ CommonAPI.follow(followed_user, user)
{:ok, repeat_activity} = CommonAPI.repeat(activity.id, followed_user)
activities = ActivityPub.fetch_activities([], %{blocking_user: user, skip_preload: true})
@@ -1452,7 +1452,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
follower = insert(:user)
followed = insert(:user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(followed, follower)
with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do
assert {:error, :reverted} = ActivityPub.unfollow(follower, followed)
@@ -1469,7 +1469,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
follower = insert(:user)
followed = insert(:user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(followed, follower)
{:ok, activity} = ActivityPub.unfollow(follower, followed)
assert activity.data["type"] == "Undo"
@@ -1486,7 +1486,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
follower = insert(:user)
followed = insert(:user, %{is_locked: true})
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(followed, follower)
{:ok, activity} = ActivityPub.unfollow(follower, followed)
assert activity.data["type"] == "Undo"
diff --git a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs
@@ -318,7 +318,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do
following_user = insert(:user)
non_following_user = insert(:user)
- {:ok, _, _, _} = CommonAPI.follow(following_user, actor)
+ {:ok, _, _, _} = CommonAPI.follow(actor, following_user)
activity = %{
"actor" => actor.ap_id,
diff --git a/test/pleroma/web/activity_pub/relay_test.exs b/test/pleroma/web/activity_pub/relay_test.exs
@@ -53,7 +53,7 @@ defmodule Pleroma.Web.ActivityPub.RelayTest do
test "returns activity" do
user = insert(:user)
service_actor = Relay.get_actor()
- CommonAPI.follow(service_actor, user)
+ CommonAPI.follow(user, service_actor)
assert "#{user.ap_id}/followers" in User.following(service_actor)
assert {:ok, %Activity{} = activity} = Relay.unfollow(user.ap_id)
assert activity.actor == "#{Pleroma.Web.Endpoint.url()}/relay"
@@ -74,7 +74,7 @@ defmodule Pleroma.Web.ActivityPub.RelayTest do
end)
service_actor = Relay.get_actor()
- CommonAPI.follow(service_actor, user)
+ CommonAPI.follow(user, service_actor)
assert "#{user.ap_id}/followers" in User.following(service_actor)
assert Pleroma.Repo.get_by(
diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs
@@ -834,7 +834,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
user = insert(:user)
followed = insert(:user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(user, followed)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(followed, user)
{:ok, reject_data, []} = Builder.reject(followed, follow_activity)
{:ok, reject, _meta} = ActivityPub.persist(reject_data, local: true)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
@@ -18,7 +18,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AcceptHandlingTest do
{:ok, follower, followed} = User.follow(follower, followed)
assert User.following?(follower, followed) == true
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(followed, follower)
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
@@ -48,7 +48,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AcceptHandlingTest do
follower = insert(:user)
followed = insert(:user, is_locked: true)
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(followed, follower)
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
diff --git a/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs
@@ -36,7 +36,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.RejectHandlingTest do
followed = insert(:user, is_locked: true)
{:ok, follower, followed} = User.follow(follower, followed)
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(followed, follower)
assert User.following?(follower, followed) == true
diff --git a/test/pleroma/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs
@@ -231,8 +231,8 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
user = insert(:user, is_locked: true)
follower = insert(:user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
- {:ok, _, _, follow_activity_two} = CommonAPI.follow(follower, user)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(user, follower)
+ {:ok, _, _, follow_activity_two} = CommonAPI.follow(user, follower)
data =
follow_activity_two.data
@@ -253,8 +253,8 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
user = insert(:user)
follower = insert(:user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
- {:ok, _, _, follow_activity_two} = CommonAPI.follow(follower, user)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(user, follower)
+ {:ok, _, _, follow_activity_two} = CommonAPI.follow(user, follower)
{:ok, follow_activity_two} =
Utils.update_follow_state_for_all(follow_activity_two, "reject")
@@ -269,8 +269,8 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
user = insert(:user, is_locked: true)
follower = insert(:user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
- {:ok, _, _, follow_activity_two} = CommonAPI.follow(follower, user)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(user, follower)
+ {:ok, _, _, follow_activity_two} = CommonAPI.follow(user, follower)
data =
follow_activity_two.data
diff --git a/test/pleroma/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs
@@ -138,7 +138,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
test "sets totalItems to zero when followers are hidden" do
user = insert(:user)
other_user = insert(:user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
assert %{"totalItems" => 1} = UserView.render("followers.json", %{user: user})
user = Map.merge(user, %{hide_followers_count: true, hide_followers: true})
refute UserView.render("followers.json", %{user: user}) |> Map.has_key?("totalItems")
@@ -147,7 +147,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
test "sets correct totalItems when followers are hidden but the follower counter is not" do
user = insert(:user)
other_user = insert(:user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
assert %{"totalItems" => 1} = UserView.render("followers.json", %{user: user})
user = Map.merge(user, %{hide_followers_count: false, hide_followers: true})
assert %{"totalItems" => 1} = UserView.render("followers.json", %{user: user})
@@ -158,7 +158,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
test "sets totalItems to zero when follows are hidden" do
user = insert(:user)
other_user = insert(:user)
- {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(other_user, user)
assert %{"totalItems" => 1} = UserView.render("following.json", %{user: user})
user = Map.merge(user, %{hide_follows_count: true, hide_follows: true})
assert %{"totalItems" => 0} = UserView.render("following.json", %{user: user})
@@ -167,7 +167,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
test "sets correct totalItems when follows are hidden but the follow counter is not" do
user = insert(:user)
other_user = insert(:user)
- {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(other_user, user)
assert %{"totalItems" => 1} = UserView.render("following.json", %{user: user})
user = Map.merge(user, %{hide_follows_count: false, hide_follows: true})
assert %{"totalItems" => 1} = UserView.render("following.json", %{user: user})
diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs
@@ -69,8 +69,8 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
# Create some activities to check they got deleted later
follower = insert(:user)
{:ok, _} = CommonAPI.post(user, %{status: "test"})
- {:ok, _, _, _} = CommonAPI.follow(user, follower)
{:ok, _, _, _} = CommonAPI.follow(follower, user)
+ {:ok, _, _, _} = CommonAPI.follow(user, follower)
user = Repo.get(User, user.id)
assert user.note_count == 1
assert user.follower_count == 1
diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs
@@ -80,8 +80,8 @@ defmodule Pleroma.Web.CommonAPITest do
setup do
blocker = insert(:user)
blocked = insert(:user, local: false)
- CommonAPI.follow(blocker, blocked)
CommonAPI.follow(blocked, blocker)
+ CommonAPI.follow(blocker, blocked)
CommonAPI.accept_follow_request(blocker, blocked)
CommonAPI.accept_follow_request(blocked, blocked)
%{blocker: blocker, blocked: blocked}
@@ -955,7 +955,7 @@ defmodule Pleroma.Web.CommonAPITest do
test "author can repeat own private statuses" do
author = insert(:user)
follower = insert(:user)
- CommonAPI.follow(follower, author)
+ CommonAPI.follow(author, follower)
{:ok, activity} = CommonAPI.post(author, %{status: "cofe", visibility: "private"})
@@ -1420,7 +1420,7 @@ defmodule Pleroma.Web.CommonAPITest do
describe "follow/2" do
test "directly follows a non-locked local user" do
[follower, followed] = insert_pair(:user)
- {:ok, follower, followed, _} = CommonAPI.follow(follower, followed)
+ {:ok, follower, followed, _} = CommonAPI.follow(followed, follower)
assert User.following?(follower, followed)
end
@@ -1429,7 +1429,7 @@ defmodule Pleroma.Web.CommonAPITest do
describe "unfollow/2" do
test "also unsubscribes a user" do
[follower, followed] = insert_pair(:user)
- {:ok, follower, followed, _} = CommonAPI.follow(follower, followed)
+ {:ok, follower, followed, _} = CommonAPI.follow(followed, follower)
{:ok, _subscription} = User.subscribe(follower, followed)
assert User.subscribed_to?(follower, followed)
@@ -1441,7 +1441,7 @@ defmodule Pleroma.Web.CommonAPITest do
test "also unpins a user" do
[follower, followed] = insert_pair(:user)
- {:ok, follower, followed, _} = CommonAPI.follow(follower, followed)
+ {:ok, follower, followed, _} = CommonAPI.follow(followed, follower)
{:ok, _endorsement} = User.endorse(follower, followed)
assert User.endorses?(follower, followed)
@@ -1456,7 +1456,7 @@ defmodule Pleroma.Web.CommonAPITest do
followed = insert(:user, is_locked: true)
assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
- CommonAPI.follow(follower, followed)
+ CommonAPI.follow(followed, follower)
assert User.get_follow_state(follower, followed) == :follow_pending
assert {:ok, follower} = CommonAPI.unfollow(follower, followed)
@@ -1478,7 +1478,7 @@ defmodule Pleroma.Web.CommonAPITest do
followed = insert(:user, is_locked: true, local: false)
assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
- CommonAPI.follow(follower, followed)
+ CommonAPI.follow(followed, follower)
assert User.get_follow_state(follower, followed) == :follow_pending
assert {:ok, follower} = CommonAPI.unfollow(follower, followed)
@@ -1502,9 +1502,9 @@ defmodule Pleroma.Web.CommonAPITest do
follower = insert(:user)
follower_two = insert(:user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
- {:ok, _, _, follow_activity_two} = CommonAPI.follow(follower, user)
- {:ok, _, _, follow_activity_three} = CommonAPI.follow(follower_two, user)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(user, follower)
+ {:ok, _, _, follow_activity_two} = CommonAPI.follow(user, follower)
+ {:ok, _, _, follow_activity_three} = CommonAPI.follow(user, follower_two)
assert follow_activity.data["state"] == "pending"
assert follow_activity_two.data["state"] == "pending"
@@ -1522,9 +1522,9 @@ defmodule Pleroma.Web.CommonAPITest do
follower = insert(:user)
follower_two = insert(:user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
- {:ok, _, _, follow_activity_two} = CommonAPI.follow(follower, user)
- {:ok, _, _, follow_activity_three} = CommonAPI.follow(follower_two, user)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(user, follower)
+ {:ok, _, _, follow_activity_two} = CommonAPI.follow(user, follower)
+ {:ok, _, _, follow_activity_three} = CommonAPI.follow(user, follower_two)
assert follow_activity.data["state"] == "pending"
assert follow_activity_two.data["state"] == "pending"
diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
@@ -1120,7 +1120,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|> json_response_and_validate_schema(200)
# Follow the user, then the pinned status can be seen
- CommonAPI.follow(reader, user)
+ CommonAPI.follow(user, reader)
ObanHelpers.perform_all()
assert [%{"id" => ^activity_id, "pinned" => true}] =
@@ -2118,7 +2118,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
test "pin account", %{user: user, conn: conn} do
%{id: id1} = other_user1 = insert(:user)
- CommonAPI.follow(user, other_user1)
+ CommonAPI.follow(other_user1, user)
assert %{"id" => ^id1, "endorsed" => true} =
conn
@@ -2136,7 +2136,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
test "unpin account", %{user: user, conn: conn} do
%{id: id1} = other_user1 = insert(:user)
- CommonAPI.follow(user, other_user1)
+ CommonAPI.follow(other_user1, user)
User.endorse(user, other_user1)
assert %{"id" => ^id1, "endorsed" => false} =
@@ -2156,8 +2156,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
%{id: id1} = other_user1 = insert(:user)
%{id: id2} = other_user2 = insert(:user)
- CommonAPI.follow(user, other_user1)
- CommonAPI.follow(user, other_user2)
+ CommonAPI.follow(other_user1, user)
+ CommonAPI.follow(other_user2, user)
conn
|> put_req_header("content-type", "application/json")
@@ -2227,7 +2227,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
test "removing user from followers", %{conn: conn, user: user} do
%{id: other_user_id} = other_user = insert(:user)
- CommonAPI.follow(other_user, user)
+ CommonAPI.follow(user, other_user)
assert %{"id" => ^other_user_id, "followed_by" => false} =
conn
@@ -2240,7 +2240,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
test "removing remote user from followers", %{conn: conn, user: user} do
%{id: other_user_id} = other_user = insert(:user, local: false)
- CommonAPI.follow(other_user, user)
+ CommonAPI.follow(user, other_user)
assert User.following?(other_user, user)
diff --git a/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs
@@ -20,7 +20,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
test "/api/v1/follow_requests works", %{user: user, conn: conn} do
other_user = insert(:user)
- {:ok, _, _, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _, _, _activity} = CommonAPI.follow(user, other_user)
{:ok, other_user, user} = User.follow(other_user, user, :follow_pending)
assert User.following?(other_user, user) == false
@@ -34,7 +34,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
test "/api/v1/follow_requests/:id/authorize works", %{user: user, conn: conn} do
other_user = insert(:user)
- {:ok, _, _, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _, _, _activity} = CommonAPI.follow(user, other_user)
{:ok, other_user, user} = User.follow(other_user, user, :follow_pending)
user = User.get_cached_by_id(user.id)
@@ -56,7 +56,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
test "/api/v1/follow_requests/:id/reject works", %{user: user, conn: conn} do
other_user = insert(:user)
- {:ok, _, _, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _, _, _activity} = CommonAPI.follow(user, other_user)
user = User.get_cached_by_id(user.id)
diff --git a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs
@@ -434,7 +434,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
{:ok, create_activity} = CommonAPI.post(user, %{status: "hey"})
{:ok, favorite_activity} = CommonAPI.favorite(create_activity.id, other_user)
{:ok, reblog_activity} = CommonAPI.repeat(create_activity.id, other_user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(other_user, user)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(user, other_user)
mention_notification_id = get_notification_id_by_activity(mention_activity)
favorite_notification_id = get_notification_id_by_activity(favorite_activity)
@@ -472,7 +472,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
{:ok, create_activity} = CommonAPI.post(user, %{status: "hey"})
{:ok, favorite_activity} = CommonAPI.favorite(create_activity.id, other_user)
{:ok, reblog_activity} = CommonAPI.repeat(create_activity.id, other_user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(other_user, user)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(user, other_user)
mention_notification_id = get_notification_id_by_activity(mention_activity)
favorite_notification_id = get_notification_id_by_activity(favorite_activity)
@@ -519,7 +519,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
{:ok, create_activity} = CommonAPI.post(user, %{status: "hey"})
{:ok, _activity} = CommonAPI.favorite(create_activity.id, other_user)
{:ok, _activity} = CommonAPI.repeat(create_activity.id, other_user)
- {:ok, _, _, follow_activity} = CommonAPI.follow(other_user, user)
+ {:ok, _, _, follow_activity} = CommonAPI.follow(user, other_user)
follow_notification_id = get_notification_id_by_activity(follow_activity)
@@ -578,7 +578,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
%{user: user, conn: conn} = oauth_access(["read:notifications"])
user2 = insert(:user)
- {:ok, _, _, _} = CommonAPI.follow(user, user2)
+ {:ok, _, _, _} = CommonAPI.follow(user2, user)
{:ok, _} = CommonAPI.post(user2, %{status: "hey @#{user.nickname}"})
ret_conn = get(conn, "/api/v1/notifications")
@@ -596,7 +596,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
%{user: user, conn: conn} = oauth_access(["read:notifications"])
user2 = insert(:user)
- {:ok, _, _, _} = CommonAPI.follow(user, user2)
+ {:ok, _, _, _} = CommonAPI.follow(user2, user)
{:ok, _} = CommonAPI.post(user2, %{status: "hey @#{user.nickname}"})
ret_conn = get(conn, "/api/v1/notifications")
@@ -614,7 +614,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
%{user: user, conn: conn} = oauth_access(["read:notifications"])
user2 = insert(:user)
- {:ok, _, _, _} = CommonAPI.follow(user, user2)
+ {:ok, _, _, _} = CommonAPI.follow(user2, user)
{:ok, _} = CommonAPI.post(user2, %{status: "hey @#{user.nickname}"})
ret_conn = get(conn, "/api/v1/notifications")
diff --git a/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs
@@ -59,7 +59,7 @@ defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do
test "returns v2 suggestions excluding followed accounts", %{conn: conn, user: follower} do
followed = insert(:user, is_suggested: true)
- {:ok, _, _, _} = CommonAPI.follow(follower, followed)
+ {:ok, _, _, _} = CommonAPI.follow(followed, follower)
res =
conn
diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs
@@ -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(user, other_user)
+ {:ok, user, other_user, _} = CommonAPI.follow(other_user, user)
user = User.get_cached_by_id(user.id)
other_user = User.get_cached_by_id(other_user.id)
@@ -547,8 +547,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
})
other_user = insert(:user)
- {:ok, user, other_user, _activity} = CommonAPI.follow(user, other_user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, user, other_user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
assert %{
followers_count: 0,
@@ -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(user, other_user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, user, other_user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _other_user, 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(user, other_user)
+ {:ok, user, other_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(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
assert %{
followers_count: 1,
@@ -684,7 +684,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
assert %{follow_requests_count: 0} =
AccountView.render("show.json", %{user: user, for: user})
@@ -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(other_user, user)
+ {:ok, _other_user, 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(other_user, user)
+ {:ok, other_user, 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(other_user, user)
+ {:ok, other_user, 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(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
{:ok, user} = User.update_and_set_cache(user, %{is_locked: false})
diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs
@@ -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(follower, followed)
+ {:ok, follower, followed, _activity} = CommonAPI.follow(followed, follower)
notification = Notification |> Repo.one() |> Repo.preload(:activity)
expected = %{
diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs
@@ -479,7 +479,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
# After following the user, the quote is rendered
follower = insert(:user)
- CommonAPI.follow(follower, user)
+ CommonAPI.follow(user, follower)
status = StatusView.render("show.json", %{activity: quote_private, for: follower})
assert status.pleroma.quote.id == to_string(private.id)
diff --git a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs
@@ -286,8 +286,8 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do
%{id: id2} = user2 = insert(:user)
%{id: id3} = user3 = insert(:user)
- CommonAPI.follow(user1, user2)
- CommonAPI.follow(user1, user3)
+ CommonAPI.follow(user2, user1)
+ CommonAPI.follow(user3, user1)
User.endorse(user1, user2)
User.endorse(user1, user3)
@@ -324,9 +324,9 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do
user3 = insert(:user)
- CommonAPI.follow(user, user1)
- CommonAPI.follow(user, user2)
- CommonAPI.follow(user, user3)
+ CommonAPI.follow(user1, user)
+ CommonAPI.follow(user2, user)
+ CommonAPI.follow(user3, user)
[%{"id" => ^id1}] =
conn
@@ -350,8 +350,8 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do
show_birthday: true
})
- CommonAPI.follow(user, user1)
- CommonAPI.follow(user, user2)
+ CommonAPI.follow(user1, user)
+ CommonAPI.follow(user2, user)
[%{"id" => ^id2}] =
conn
diff --git a/test/pleroma/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs
@@ -78,7 +78,7 @@ defmodule Pleroma.Web.Push.ImplTest do
)
other_user = insert(:user)
- {:ok, _, _, activity} = CommonAPI.follow(user, other_user)
+ {:ok, _, _, activity} = CommonAPI.follow(other_user, user)
notif =
insert(:notification,
@@ -103,7 +103,7 @@ defmodule Pleroma.Web.Push.ImplTest do
)
other_user = insert(:user)
- {:ok, _, _, activity} = CommonAPI.follow(user, other_user)
+ {:ok, _, _, activity} = CommonAPI.follow(other_user, user)
notif =
insert(:notification,
@@ -154,7 +154,7 @@ defmodule Pleroma.Web.Push.ImplTest do
test "renders title and body for follow activity" do
user = insert(:user, nickname: "Bob")
other_user = insert(:user)
- {:ok, _, _, activity} = CommonAPI.follow(user, other_user)
+ {:ok, _, _, activity} = CommonAPI.follow(other_user, user)
object = Object.normalize(activity, fetch: false)
assert Impl.format_body(%{activity: activity, type: "follow"}, user, object) ==
diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs
@@ -477,7 +477,7 @@ defmodule Pleroma.Web.StreamerTest do
user2 = insert(:user)
Streamer.get_topic_and_add_socket("user:notification", user, oauth_token)
- {:ok, _follower, _followed, follow_activity} = CommonAPI.follow(user2, user)
+ {:ok, _follower, _followed, follow_activity} = CommonAPI.follow(user, user2)
assert_receive {:render_with_user, _, "notification.json", notif, _}
assert notif.activity.id == follow_activity.id
@@ -493,7 +493,7 @@ defmodule Pleroma.Web.StreamerTest do
other_user_id = other_user.id
Streamer.get_topic_and_add_socket("user", user, oauth_token)
- {:ok, _follower, _followed, _follow_activity} = CommonAPI.follow(user, other_user)
+ {:ok, _follower, _followed, _follow_activity} = CommonAPI.follow(other_user, user)
assert_receive {:text, event}
@@ -536,7 +536,7 @@ defmodule Pleroma.Web.StreamerTest do
test "it streams edits in the 'user' stream", %{user: user, token: oauth_token} do
sender = insert(:user)
- {:ok, _, _, _} = CommonAPI.follow(user, sender)
+ {:ok, _, _, _} = CommonAPI.follow(sender, user)
{:ok, activity} = CommonAPI.post(sender, %{status: "hey"})
@@ -826,7 +826,7 @@ defmodule Pleroma.Web.StreamerTest do
test "it filters muted reblogs", %{user: user1, token: user1_token} do
user2 = insert(:user)
user3 = insert(:user)
- CommonAPI.follow(user1, user2)
+ CommonAPI.follow(user2, user1)
CommonAPI.hide_reblogs(user1, user2)
{:ok, create_activity} = CommonAPI.post(user3, %{status: "I'm kawen"})
@@ -842,7 +842,7 @@ defmodule Pleroma.Web.StreamerTest do
token: user1_token
} do
user2 = insert(:user)
- CommonAPI.follow(user1, user2)
+ CommonAPI.follow(user2, user1)
CommonAPI.hide_reblogs(user1, user2)
{:ok, create_activity} = CommonAPI.post(user1, %{status: "I'm kawen"})
@@ -858,7 +858,7 @@ defmodule Pleroma.Web.StreamerTest do
token: user1_token
} do
user2 = insert(:user)
- CommonAPI.follow(user1, user2)
+ CommonAPI.follow(user2, user1)
CommonAPI.hide_reblogs(user1, user2)
{:ok, create_activity} = CommonAPI.post(user1, %{status: "I'm kawen"})
@@ -876,7 +876,7 @@ defmodule Pleroma.Web.StreamerTest do
%{user: user2, token: user2_token} = oauth_access(["read"])
Streamer.get_topic_and_add_socket("user", user2, user2_token)
- {:ok, user2, user, _activity} = CommonAPI.follow(user2, user)
+ {:ok, user2, user, _activity} = CommonAPI.follow(user, user2)
{:ok, activity} = CommonAPI.post(user, %{status: "super hot take"})
{:ok, _} = CommonAPI.add_mute(activity, user2)
@@ -1026,8 +1026,8 @@ defmodule Pleroma.Web.StreamerTest do
%{user: user2, token: user2_token} = oauth_access(["read"])
post_user = insert(:user)
- CommonAPI.follow(user, post_user)
- CommonAPI.follow(user2, post_user)
+ CommonAPI.follow(post_user, user)
+ CommonAPI.follow(post_user, user2)
tasks = [
Task.async(child_proc.(starter.(user, token), hit)),
@@ -1058,7 +1058,7 @@ defmodule Pleroma.Web.StreamerTest do
%{user: user, token: token} = oauth_access(["read"])
post_user = insert(:user)
- CommonAPI.follow(user, post_user)
+ CommonAPI.follow(post_user, user)
tasks = [
Task.async(child_proc.(starter.(user, token), hit)),
diff --git a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs
@@ -216,7 +216,7 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
test "returns success result when user already in followers", %{conn: conn} do
user = insert(:user)
user2 = insert(:user)
- {:ok, _, _, _} = CommonAPI.follow(user, user2)
+ {:ok, _, _, _} = CommonAPI.follow(user2, user)
conn =
conn