diff options
27 files changed, 90 insertions, 90 deletions
| diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index 411acf8fb..f8a03680a 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -247,8 +247,8 @@ defmodule Pleroma.Web.CommonAPI do      end    end -  @spec favorite(User.t(), String.t()) :: {:ok, Activity.t()} | {:error, any()} -  def favorite(%User{} = user, id) do +  @spec favorite(String.t(), User.t()) :: {:ok, Activity.t()} | {:error, any()} +  def favorite(id, %User{} = user) do      case favorite_helper(user, id) do        {:ok, _} = res ->          res diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 83e1bee54..80386dc45 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -357,7 +357,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do            conn,          _        ) do -    with {:ok, _fav} <- CommonAPI.favorite(user, activity_id), +    with {:ok, _fav} <- CommonAPI.favorite(activity_id, user),           %Activity{} = activity <- Activity.get_by_id(activity_id) do        try_render(conn, "show.json", activity: activity, for: user, as: :activity)      end diff --git a/test/mix/tasks/pleroma/database_test.exs b/test/mix/tasks/pleroma/database_test.exs index d773038cb..a51a3bf3d 100644 --- a/test/mix/tasks/pleroma/database_test.exs +++ b/test/mix/tasks/pleroma/database_test.exs @@ -251,7 +251,7 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do        |> Repo.update!()        {:ok, old_favourite_activity} = -        CommonAPI.favorite(remote_user2, old_remote_post_activity.id) +        CommonAPI.favorite(old_remote_post_activity.id, remote_user2)        old_favourite_activity        |> Ecto.Changeset.change(%{local: false, updated_at: old_insert_date}) @@ -302,7 +302,7 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do        |> Ecto.Changeset.change(%{local: false, updated_at: old_insert_date})        |> Repo.update!() -      {:ok, old_favourite_activity} = CommonAPI.favorite(local_user, old_remote_post3_activity.id) +      {:ok, old_favourite_activity} = CommonAPI.favorite(old_remote_post3_activity.id, local_user)        old_favourite_activity        |> Ecto.Changeset.change(%{local: true, updated_at: old_insert_date}) @@ -586,7 +586,7 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do        {:ok, %{id: id, object: object}} = CommonAPI.post(user, %{status: "test"})        {:ok, %{object: object2}} = CommonAPI.post(user, %{status: "test test"}) -      CommonAPI.favorite(user2, id) +      CommonAPI.favorite(id, user2)        likes = %{          "first" => diff --git a/test/pleroma/activity_test.exs b/test/pleroma/activity_test.exs index 67943d879..62d07b1ee 100644 --- a/test/pleroma/activity_test.exs +++ b/test/pleroma/activity_test.exs @@ -249,7 +249,7 @@ defmodule Pleroma.ActivityTest do      {:ok, %{id: id, object: %{data: %{"id" => obj_id}}}} =        Pleroma.Web.CommonAPI.post(user, %{status: "cofe"}) -    Pleroma.Web.CommonAPI.favorite(another, id) +    Pleroma.Web.CommonAPI.favorite(id, another)      assert obj_id             |> Pleroma.Activity.Queries.by_object_id() diff --git a/test/pleroma/migration_helper/notification_backfill_test.exs b/test/pleroma/migration_helper/notification_backfill_test.exs index 6d47bb6a8..2797cfb2c 100644 --- a/test/pleroma/migration_helper/notification_backfill_test.exs +++ b/test/pleroma/migration_helper/notification_backfill_test.exs @@ -21,7 +21,7 @@ defmodule Pleroma.MigrationHelper.NotificationBackfillTest do        {:ok, post} = CommonAPI.post(user, %{status: "yeah, @#{other_user.nickname}"})        {:ok, chat} = CommonAPI.post_chat_message(user, other_user, "yo")        {:ok, react} = CommonAPI.react_with_emoji(post.id, other_user, "☕") -      {:ok, like} = CommonAPI.favorite(other_user, post.id) +      {:ok, like} = CommonAPI.favorite(post.id, other_user)        {:ok, react_2} = CommonAPI.react_with_emoji(post.id, other_user, "☕")        data = diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs index 21bea4c3f..e9923cb56 100644 --- a/test/pleroma/notification_test.exs +++ b/test/pleroma/notification_test.exs @@ -295,7 +295,7 @@ defmodule Pleroma.NotificationTest do        insert(:filter, user: user, phrase: "tesla", hide: true)        {:ok, activity_one} = CommonAPI.post(user, %{status: "wow tesla"}) -      {:ok, activity_two} = CommonAPI.favorite(other_user, activity_one.id) +      {:ok, activity_two} = CommonAPI.favorite(activity_one.id, other_user)        {:ok, [notification]} = Notification.create_notifications(activity_two) @@ -617,7 +617,7 @@ defmodule Pleroma.NotificationTest do            status: "hey @#{other_user.nickname}!"          }) -      {:ok, activity_two} = CommonAPI.favorite(third_user, activity_one.id) +      {:ok, activity_two} = CommonAPI.favorite(activity_one.id, third_user)        enabled_receivers = Notification.get_notified_from_activity(activity_two) @@ -768,7 +768,7 @@ defmodule Pleroma.NotificationTest do        assert Enum.empty?(Notification.for_user(user)) -      {:ok, _} = CommonAPI.favorite(other_user, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, other_user)        assert length(Notification.for_user(user)) == 1 @@ -785,7 +785,7 @@ defmodule Pleroma.NotificationTest do        assert Enum.empty?(Notification.for_user(user)) -      {:ok, _} = CommonAPI.favorite(other_user, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, other_user)        assert length(Notification.for_user(user)) == 1 @@ -840,7 +840,7 @@ defmodule Pleroma.NotificationTest do        assert Enum.empty?(Notification.for_user(user)) -      {:error, :not_found} = CommonAPI.favorite(other_user, activity.id) +      {:error, :not_found} = CommonAPI.favorite(activity.id, other_user)        assert Enum.empty?(Notification.for_user(user))      end @@ -1090,7 +1090,7 @@ defmodule Pleroma.NotificationTest do        another_user = insert(:user)        {:ok, activity} = CommonAPI.post(user, %{status: "Give me my cofe!"}) -      {:ok, _} = CommonAPI.favorite(another_user, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, another_user)        assert length(Notification.for_user(user)) == 1      end diff --git a/test/pleroma/object_test.exs b/test/pleroma/object_test.exs index 2025d93e4..48d4d86eb 100644 --- a/test/pleroma/object_test.exs +++ b/test/pleroma/object_test.exs @@ -403,7 +403,7 @@ defmodule Pleroma.ObjectTest do        user = insert(:user)        activity = Activity.get_create_by_object_ap_id(object.data["id"]) -      {:ok, activity} = CommonAPI.favorite(user, activity.id) +      {:ok, activity} = CommonAPI.favorite(activity.id, user)        object = Object.get_by_ap_id(activity.data["object"])        assert object.data["like_count"] == 1 diff --git a/test/pleroma/resilience_test.exs b/test/pleroma/resilience_test.exs index 9dc5d0dd6..0c4195fa8 100644 --- a/test/pleroma/resilience_test.exs +++ b/test/pleroma/resilience_test.exs @@ -18,7 +18,7 @@ defmodule Pleroma.ResilienceTest do      other_user = insert(:user)      {:ok, post_one} = CommonAPI.post(user, %{status: "Here is a post"}) -    {:ok, like} = CommonAPI.favorite(other_user, post_one.id) +    {:ok, like} = CommonAPI.favorite(post_one.id, other_user)      %{        user: user, @@ -90,7 +90,7 @@ defmodule Pleroma.ResilienceTest do               |> json_response(200)      # Favoriting again doesn't hurt -    {:ok, _like_two} = CommonAPI.favorite(other_user, post.id) +    {:ok, _like_two} = CommonAPI.favorite(post.id, other_user)      post = Repo.get(Activity, post.id) diff --git a/test/pleroma/stats_test.exs b/test/pleroma/stats_test.exs index 37a085afc..a04bed28e 100644 --- a/test/pleroma/stats_test.exs +++ b/test/pleroma/stats_test.exs @@ -74,7 +74,7 @@ defmodule Pleroma.StatsTest do        other_user = insert(:user)        {:ok, activity} = CommonAPI.post(user, %{visibility: "public", status: "hey"})        _ = CommonAPI.follow(user, other_user) -      CommonAPI.favorite(other_user, activity.id) +      CommonAPI.favorite(activity.id, other_user)        CommonAPI.repeat(activity.id, other_user)        assert %{"direct" => 0, "private" => 0, "public" => 1, "unlisted" => 0} = diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs index 753e35982..fbde7fde8 100644 --- a/test/pleroma/user/backup_test.exs +++ b/test/pleroma/user/backup_test.exs @@ -177,8 +177,8 @@ defmodule Pleroma.User.BackupTest do      {:ok, %{object: %{data: %{"id" => id3}}} = status3} =        CommonAPI.post(user, %{status: "status3"}) -    CommonAPI.favorite(user, status1.id) -    CommonAPI.favorite(user, status2.id) +    CommonAPI.favorite(status1.id, user) +    CommonAPI.favorite(status2.id, user)      Bookmark.create(user.id, status2.id)      Bookmark.create(user.id, status3.id) @@ -283,7 +283,7 @@ defmodule Pleroma.User.BackupTest do      Enum.map(1..120, fn i ->        {:ok, status} = CommonAPI.post(user, %{status: "status #{i}"}) -      CommonAPI.favorite(user, status.id) +      CommonAPI.favorite(status.id, user)        Bookmark.create(user.id, status.id)      end) @@ -337,8 +337,8 @@ defmodule Pleroma.User.BackupTest do        {:ok, status1} = CommonAPI.post(user, %{status: "status1"})        {:ok, status2} = CommonAPI.post(user, %{status: "status2"})        {:ok, status3} = CommonAPI.post(user, %{status: "status3"}) -      CommonAPI.favorite(user, status1.id) -      CommonAPI.favorite(user, status2.id) +      CommonAPI.favorite(status1.id, user) +      CommonAPI.favorite(status2.id, user)        Bookmark.create(user.id, status2.id)        Bookmark.create(user.id, status3.id) diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 78018fedc..2dc1b839d 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1691,8 +1691,8 @@ defmodule Pleroma.UserTest do        object_two = insert(:note, user: follower)        activity_two = insert(:note_activity, user: follower, note: object_two) -      {:ok, like} = CommonAPI.favorite(user, activity_two.id) -      {:ok, like_two} = CommonAPI.favorite(follower, activity.id) +      {:ok, like} = CommonAPI.favorite(activity_two.id, user) +      {:ok, like_two} = CommonAPI.favorite(activity.id, follower)        {:ok, repeat} = CommonAPI.repeat(activity_two.id, user)        {:ok, job} = User.delete(user) diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index 043efeda1..cc67b72d2 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -1224,7 +1224,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do        note = insert(:note_activity, user: reported_user) -      Pleroma.Web.CommonAPI.favorite(another, note.id) +      Pleroma.Web.CommonAPI.favorite(note.id, another)        mock_json_body =          "test/fixtures/mastodon/application_actor.json" diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index c3c59df35..2fc1f3520 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -1854,14 +1854,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        {:ok, a4} = CommonAPI.post(user2, %{status: "Agent Smith "})        {:ok, a5} = CommonAPI.post(user1, %{status: "Red or Blue "}) -      {:ok, _} = CommonAPI.favorite(user, a4.id) -      {:ok, _} = CommonAPI.favorite(other_user, a3.id) -      {:ok, _} = CommonAPI.favorite(user, a3.id) -      {:ok, _} = CommonAPI.favorite(other_user, a5.id) -      {:ok, _} = CommonAPI.favorite(user, a5.id) -      {:ok, _} = CommonAPI.favorite(other_user, a4.id) -      {:ok, _} = CommonAPI.favorite(user, a1.id) -      {:ok, _} = CommonAPI.favorite(other_user, a1.id) +      {:ok, _} = CommonAPI.favorite(a4.id, user) +      {:ok, _} = CommonAPI.favorite(a3.id, other_user) +      {:ok, _} = CommonAPI.favorite(a3.id, user) +      {:ok, _} = CommonAPI.favorite(a5.id, other_user) +      {:ok, _} = CommonAPI.favorite(a5.id, user) +      {:ok, _} = CommonAPI.favorite(a4.id, other_user) +      {:ok, _} = CommonAPI.favorite(a1.id, user) +      {:ok, _} = CommonAPI.favorite(a1.id, other_user)        result = ActivityPub.fetch_favourites(user)        assert Enum.map(result, & &1.id) == [a1.id, a5.id, a3.id, a4.id] diff --git a/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs index ebc181a6d..620173119 100644 --- a/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs @@ -94,7 +94,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.LikeValidationTest do        user: user,        post_activity: post_activity      } do -      _like = CommonAPI.favorite(user, post_activity.id) +      _like = CommonAPI.favorite(post_activity.id, user)        refute LikeValidator.cast_and_validate(valid_like).valid?      end diff --git a/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs index db95b8e3c..589b70ac7 100644 --- a/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs @@ -15,7 +15,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UndoHandlingTest do      setup do        user = insert(:user)        {:ok, post_activity} = CommonAPI.post(user, %{status: "uguu"}) -      {:ok, like} = CommonAPI.favorite(user, post_activity.id) +      {:ok, like} = CommonAPI.favorite(post_activity.id, user)        {:ok, valid_like_undo, []} = Builder.undo(user, like)        %{user: user, like: like, valid_like_undo: valid_like_undo} diff --git a/test/pleroma/web/activity_pub/side_effects/delete_test.exs b/test/pleroma/web/activity_pub/side_effects/delete_test.exs index 9a2703c4c..637007b7e 100644 --- a/test/pleroma/web/activity_pub/side_effects/delete_test.exs +++ b/test/pleroma/web/activity_pub/side_effects/delete_test.exs @@ -50,7 +50,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects.DeleteTest do        {:ok, op} = CommonAPI.post(other_user, %{status: "big oof"})        {:ok, post} = CommonAPI.post(user, %{status: "hey", in_reply_to_id: op}) -      {:ok, favorite} = CommonAPI.favorite(user, post.id) +      {:ok, favorite} = CommonAPI.favorite(post.id, user)        object = Object.normalize(post, fetch: false)        {:ok, delete_data, _meta} = Builder.delete(user, object.data["id"])        {:ok, delete, _meta} = ActivityPub.persist(delete_data, local: true) diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs index 7af50e12c..8c115cedd 100644 --- a/test/pleroma/web/activity_pub/side_effects_test.exs +++ b/test/pleroma/web/activity_pub/side_effects_test.exs @@ -516,7 +516,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do        poster = insert(:user)        user = insert(:user)        {:ok, post} = CommonAPI.post(poster, %{status: "hey"}) -      {:ok, like} = CommonAPI.favorite(user, post.id) +      {:ok, like} = CommonAPI.favorite(post.id, user)        {:ok, reaction} = CommonAPI.react_with_emoji(post.id, user, "👍")        {:ok, announce} = CommonAPI.repeat(post.id, user)        {:ok, block} = CommonAPI.block(user, poster) diff --git a/test/pleroma/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs index cd61e3e4b..47eea9a25 100644 --- a/test/pleroma/web/activity_pub/utils_test.exs +++ b/test/pleroma/web/activity_pub/utils_test.exs @@ -220,7 +220,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do        object = Object.normalize(activity, fetch: false)        {:ok, [vote], object} = CommonAPI.vote(other_user, object, [0]) -      {:ok, _activity} = CommonAPI.favorite(user, activity.id) +      {:ok, _activity} = CommonAPI.favorite(activity.id, user)        [fetched_vote] = Utils.get_existing_votes(other_user.ap_id, object)        assert fetched_vote.id == vote.id      end @@ -355,7 +355,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do        user = insert(:user)        refute Utils.get_existing_like(user.ap_id, object) -      {:ok, like_activity} = CommonAPI.favorite(user, note_activity.id) +      {:ok, like_activity} = CommonAPI.favorite(note_activity.id, user)        assert ^like_activity = Utils.get_existing_like(user.ap_id, object)      end @@ -546,7 +546,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do        target_account = insert(:user)        {:ok, activity} = CommonAPI.post(posting_account, %{status: "foobar"}) -      {:ok, like} = CommonAPI.favorite(target_account, activity.id) +      {:ok, like} = CommonAPI.favorite(activity.id, target_account)        context = Utils.generate_context_id()        content = "foobar" diff --git a/test/pleroma/web/activity_pub/views/object_view_test.exs b/test/pleroma/web/activity_pub/views/object_view_test.exs index d94878e31..14258795f 100644 --- a/test/pleroma/web/activity_pub/views/object_view_test.exs +++ b/test/pleroma/web/activity_pub/views/object_view_test.exs @@ -59,7 +59,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectViewTest do      object = Object.normalize(note, fetch: false)      user = insert(:user) -    {:ok, like_activity} = CommonAPI.favorite(user, note.id) +    {:ok, like_activity} = CommonAPI.favorite(note.id, user)      result = ObjectView.render("object.json", %{object: like_activity}) diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 4c1add82e..4f3bc6921 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -454,7 +454,7 @@ defmodule Pleroma.Web.CommonAPITest do      users_serial      |> Enum.map(fn user -> -      CommonAPI.favorite(user, activity.id) +      CommonAPI.favorite(activity.id, user)      end)      object = Object.get_by_ap_id(activity.data["object"]) @@ -463,7 +463,7 @@ defmodule Pleroma.Web.CommonAPITest do      users      |> Enum.map(fn user ->        Task.async(fn -> -        CommonAPI.favorite(user, activity.id) +        CommonAPI.favorite(activity.id, user)        end)      end)      |> Enum.map(&Task.await/1) @@ -974,7 +974,7 @@ defmodule Pleroma.Web.CommonAPITest do        {:ok, post_activity} = CommonAPI.post(other_user, %{status: "cofe"}) -      {:ok, %Activity{data: data}} = CommonAPI.favorite(user, post_activity.id) +      {:ok, %Activity{data: data}} = CommonAPI.favorite(post_activity.id, user)        assert data["type"] == "Like"        assert data["actor"] == user.ap_id        assert data["object"] == post_activity.data["object"] @@ -994,8 +994,8 @@ defmodule Pleroma.Web.CommonAPITest do        other_user = insert(:user)        {:ok, activity} = CommonAPI.post(other_user, %{status: "cofe"}) -      {:ok, %Activity{}} = CommonAPI.favorite(user, activity.id) -      assert {:ok, :already_liked} = CommonAPI.favorite(user, activity.id) +      {:ok, %Activity{}} = CommonAPI.favorite(activity.id, user) +      assert {:ok, :already_liked} = CommonAPI.favorite(activity.id, user)      end    end @@ -1149,7 +1149,7 @@ defmodule Pleroma.Web.CommonAPITest do            }          ) -      {:ok, favorite_activity} = CommonAPI.favorite(friend2, activity.id) +      {:ok, favorite_activity} = CommonAPI.favorite(activity.id, friend2)        {:ok, repeat_activity} = CommonAPI.repeat(activity.id, friend1)        assert Repo.aggregate( @@ -1695,7 +1695,7 @@ defmodule Pleroma.Web.CommonAPITest do        with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do          assert {:ok, %Activity{data: %{"type" => "Like"}} = activity} = -                 CommonAPI.favorite(user, activity.id) +                 CommonAPI.favorite(activity.id, user)          assert Visibility.local_public?(activity)          refute called(Pleroma.Web.Federator.publish(activity)) @@ -1708,7 +1708,7 @@ defmodule Pleroma.Web.CommonAPITest do        {:ok, activity} = CommonAPI.post(other_user, %{status: "cofe", visibility: "local"}) -      {:ok, %Activity{}} = CommonAPI.favorite(user, activity.id) +      {:ok, %Activity{}} = CommonAPI.favorite(activity.id, user)        with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do          assert {:ok, activity} = CommonAPI.unfavorite(activity.id, user) @@ -2002,7 +2002,7 @@ defmodule Pleroma.Web.CommonAPITest do          CommonAPI.post(remote_user, %{status: "I like turtles!"})        {:ok, %{data: %{"id" => ap_id}} = _favorite} = -        CommonAPI.favorite(local_user, activity.id) +        CommonAPI.favorite(activity.id, local_user)        # Generate the publish_one jobs        ObanHelpers.perform_all() diff --git a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs index 350b935d7..c3a2a4e25 100644 --- a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs @@ -326,10 +326,10 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do        {:ok, private_activity} = CommonAPI.post(other_user, %{status: ".", visibility: "private"}) -      {:ok, _} = CommonAPI.favorite(user, public_activity.id) -      {:ok, _} = CommonAPI.favorite(user, direct_activity.id) -      {:ok, _} = CommonAPI.favorite(user, unlisted_activity.id) -      {:ok, _} = CommonAPI.favorite(user, private_activity.id) +      {:ok, _} = CommonAPI.favorite(public_activity.id, user) +      {:ok, _} = CommonAPI.favorite(direct_activity.id, user) +      {:ok, _} = CommonAPI.favorite(unlisted_activity.id, user) +      {:ok, _} = CommonAPI.favorite(private_activity.id, user)        activity_ids =          conn @@ -414,7 +414,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do            in_reply_to_status_id: activity.id          }) -      {:ok, _favorite} = CommonAPI.favorite(user, reply.id) +      {:ok, _favorite} = CommonAPI.favorite(reply.id, user)        activity_ids =          conn @@ -432,7 +432,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do      {:ok, mention_activity} = CommonAPI.post(other_user, %{status: "hey @#{user.nickname}"})      {:ok, create_activity} = CommonAPI.post(user, %{status: "hey"}) -    {:ok, favorite_activity} = CommonAPI.favorite(other_user, create_activity.id) +    {: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) @@ -470,7 +470,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do      {:ok, mention_activity} = CommonAPI.post(other_user, %{status: "hey @#{user.nickname}"})      {:ok, create_activity} = CommonAPI.post(user, %{status: "hey"}) -    {:ok, favorite_activity} = CommonAPI.favorite(other_user, create_activity.id) +    {: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) @@ -517,7 +517,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do      {:ok, _activity} = CommonAPI.post(other_user, %{status: "hey @#{user.nickname}"})      {:ok, create_activity} = CommonAPI.post(user, %{status: "hey"}) -    {:ok, _activity} = CommonAPI.favorite(other_user, create_activity.id) +    {: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) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index f34911e5b..eb43f964a 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -1356,7 +1356,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do        user1 = insert(:user)        user2 = insert(:user)        user3 = insert(:user) -      {:ok, _} = CommonAPI.favorite(user2, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, user2)        {:ok, _bookmark} = Pleroma.Bookmark.create(user2.id, activity.id)        {:ok, reblog_activity1} = CommonAPI.repeat(activity.id, user1)        {:ok, _} = CommonAPI.repeat(activity.id, user2) @@ -1483,7 +1483,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do      test "unfavorites a status and returns it", %{user: user, conn: conn} do        activity = insert(:note_activity) -      {:ok, _} = CommonAPI.favorite(user, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, user)        conn =          conn @@ -1859,7 +1859,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do      test "returns users who have favorited the status", %{conn: conn, activity: activity} do        other_user = insert(:user) -      {:ok, _} = CommonAPI.favorite(other_user, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, other_user)        response =          conn @@ -1890,7 +1890,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do        other_user = insert(:user)        {:ok, _user_relationship} = User.block(user, other_user) -      {:ok, _} = CommonAPI.favorite(other_user, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, other_user)        response =          conn @@ -1902,7 +1902,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do      test "does not fail on an unauthenticated request", %{activity: activity} do        other_user = insert(:user) -      {:ok, _} = CommonAPI.favorite(other_user, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, other_user)        response =          build_conn() @@ -1922,7 +1922,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do            visibility: "direct"          }) -      {:ok, _} = CommonAPI.favorite(other_user, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, other_user)        favourited_by_url = "/api/v1/statuses/#{activity.id}/favourited_by" @@ -1953,7 +1953,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do        clear_config([:instance, :show_reactions], false)        other_user = insert(:user) -      {:ok, _} = CommonAPI.favorite(other_user, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, other_user)        response =          conn @@ -2096,9 +2096,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do      {:ok, second_post} = CommonAPI.post(other_user, %{status: "bla"})      {:ok, third_post} = CommonAPI.post(other_user, %{status: "bla"}) -    {:ok, _first_favorite} = CommonAPI.favorite(user, third_post.id) -    {:ok, _second_favorite} = CommonAPI.favorite(user, first_post.id) -    {:ok, third_favorite} = CommonAPI.favorite(user, second_post.id) +    {:ok, _first_favorite} = CommonAPI.favorite(third_post.id, user) +    {:ok, _second_favorite} = CommonAPI.favorite(first_post.id, user) +    {:ok, third_favorite} = CommonAPI.favorite(second_post.id, user)      result =        conn @@ -2134,7 +2134,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do      {:ok, _} = CommonAPI.post(other_user, %{status: "bla"})      {:ok, activity} = CommonAPI.post(other_user, %{status: "trees are happy"}) -    {:ok, last_like} = CommonAPI.favorite(user, activity.id) +    {:ok, last_like} = CommonAPI.favorite(activity.id, user)      first_conn = get(conn, "/api/v1/favourites") @@ -2150,7 +2150,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do          status: "Trees Are Never Sad Look At Them Every Once In Awhile They're Quite Beautiful."        }) -    {:ok, _} = CommonAPI.favorite(user, second_activity.id) +    {:ok, _} = CommonAPI.favorite(second_activity.id, user)      second_conn = get(conn, "/api/v1/favourites?since_id=#{last_like.id}") diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index 9896f81b6..003ac8c36 100644 --- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs @@ -93,7 +93,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do      user = insert(:user)      another_user = insert(:user)      {:ok, create_activity} = CommonAPI.post(user, %{status: "hey"}) -    {:ok, favorite_activity} = CommonAPI.favorite(another_user, create_activity.id) +    {:ok, favorite_activity} = CommonAPI.favorite(create_activity.id, another_user)      {:ok, [notification]} = Notification.create_notifications(favorite_activity)      create_activity = Activity.get_by_id(create_activity.id) @@ -316,7 +316,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do      {:ok, _} = Pleroma.UserRelationship.create_mute(user, another_user)      {:ok, create_activity} = CommonAPI.post(user, %{status: "hey"}) -    {:ok, favorite_activity} = CommonAPI.favorite(another_user, create_activity.id) +    {:ok, favorite_activity} = CommonAPI.favorite(create_activity.id, another_user)      {:ok, [notification]} = Notification.create_notifications(favorite_activity)      create_activity = Activity.get_by_id(create_activity.id) diff --git a/test/pleroma/web/o_status/o_status_controller_test.exs b/test/pleroma/web/o_status/o_status_controller_test.exs index 3e8fcd956..5387ec94e 100644 --- a/test/pleroma/web/o_status/o_status_controller_test.exs +++ b/test/pleroma/web/o_status/o_status_controller_test.exs @@ -186,7 +186,7 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do        user = insert(:user) -      {:ok, like_activity} = CommonAPI.favorite(user, note_activity.id) +      {:ok, like_activity} = CommonAPI.favorite(note_activity.id, user)        assert like_activity.data["type"] == "Like" diff --git a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs index 8f000760f..5af5a6138 100644 --- a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs @@ -78,7 +78,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do        user: user      } do        [activity | _] = insert_pair(:note_activity) -      CommonAPI.favorite(user, activity.id) +      CommonAPI.favorite(activity.id, user)        response =          conn @@ -95,7 +95,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do        user: user      } do        activity = insert(:note_activity) -      CommonAPI.favorite(user, activity.id) +      CommonAPI.favorite(activity.id, user)        response =          build_conn() @@ -115,7 +115,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do            visibility: "direct"          }) -      CommonAPI.favorite(user, direct.id) +      CommonAPI.favorite(direct.id, user)        for u <- [user, current_user] do          response = @@ -148,7 +148,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do            visibility: "direct"          }) -      CommonAPI.favorite(user, direct.id) +      CommonAPI.favorite(direct.id, user)        response =          conn @@ -165,7 +165,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do        activities = insert_list(10, :note_activity)        Enum.each(activities, fn activity -> -        CommonAPI.favorite(user, activity.id) +        CommonAPI.favorite(activity.id, user)        end)        third_activity = Enum.at(activities, 2) @@ -190,7 +190,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do        7        |> insert_list(:note_activity)        |> Enum.each(fn activity -> -        CommonAPI.favorite(user, activity.id) +        CommonAPI.favorite(activity.id, user)        end)        response = @@ -222,7 +222,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do      test "returns 403 error when user has hidden own favorites", %{conn: conn} do        user = insert(:user, hide_favorites: true)        activity = insert(:note_activity) -      CommonAPI.favorite(user, activity.id) +      CommonAPI.favorite(activity.id, user)        conn = get(conn, "/api/v1/pleroma/accounts/#{user.id}/favourites") @@ -232,7 +232,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do      test "hides favorites for new users by default", %{conn: conn} do        user = insert(:user)        activity = insert(:note_activity) -      CommonAPI.favorite(user, activity.id) +      CommonAPI.favorite(activity.id, user)        assert user.hide_favorites        conn = get(conn, "/api/v1/pleroma/accounts/#{user.id}/favourites") diff --git a/test/pleroma/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs index adaae93d0..5e2b20ab5 100644 --- a/test/pleroma/web/push/impl_test.exs +++ b/test/pleroma/web/push/impl_test.exs @@ -192,7 +192,7 @@ defmodule Pleroma.Web.Push.ImplTest do            "<span>Lorem ipsum dolor sit amet</span>, consectetur :firefox: adipiscing elit. Fusce sagittis finibus turpis."        }) -    {:ok, activity} = CommonAPI.favorite(user, activity.id) +    {:ok, activity} = CommonAPI.favorite(activity.id, user)      object = Object.normalize(activity, fetch: false)      assert Impl.format_body(%{activity: activity, type: "favourite"}, user, object) == @@ -351,7 +351,7 @@ defmodule Pleroma.Web.Push.ImplTest do                 body: "New Mention"               } -      {:ok, activity} = CommonAPI.favorite(user, activity.id) +      {:ok, activity} = CommonAPI.favorite(activity.id, user)        notif = insert(:notification, user: user2, activity: activity, type: "favourite") @@ -408,7 +408,7 @@ defmodule Pleroma.Web.Push.ImplTest do                 title: "New Mention"               } -      {:ok, activity} = CommonAPI.favorite(user, activity.id) +      {:ok, activity} = CommonAPI.favorite(activity.id, user)        notif = insert(:notification, user: user2, activity: activity, type: "favourite") diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs index d85358fd4..978e8a823 100644 --- a/test/pleroma/web/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs @@ -418,7 +418,7 @@ defmodule Pleroma.Web.StreamerTest do        Streamer.get_topic_and_add_socket("user:notification", user, oauth_token)        {:ok, activity} = CommonAPI.post(user, %{status: ":("}) -      {:ok, _} = CommonAPI.favorite(blocked, activity.id) +      {:ok, _} = CommonAPI.favorite(activity.id, blocked)        refute_receive _      end @@ -434,7 +434,7 @@ defmodule Pleroma.Web.StreamerTest do        Streamer.get_topic_and_add_socket("user:notification", user, oauth_token) -      {:ok, favorite_activity} = CommonAPI.favorite(user2, activity.id) +      {:ok, favorite_activity} = CommonAPI.favorite(activity.id, user2)        refute_receive _        assert Streamer.filtered_by_user?(user, favorite_activity) @@ -448,7 +448,7 @@ defmodule Pleroma.Web.StreamerTest do        {:ok, activity} = CommonAPI.post(user, %{status: "super hot take"})        Streamer.get_topic_and_add_socket("user:notification", user, oauth_token) -      {:ok, favorite_activity} = CommonAPI.favorite(user2, activity.id) +      {:ok, favorite_activity} = CommonAPI.favorite(activity.id, user2)        assert_receive {:render_with_user, _, "notification.json", notif, _}        assert notif.activity.id == favorite_activity.id @@ -464,7 +464,7 @@ defmodule Pleroma.Web.StreamerTest do        {:ok, user} = User.block_domain(user, "hecking-lewd-place.com")        {:ok, activity} = CommonAPI.post(user, %{status: "super hot take"})        Streamer.get_topic_and_add_socket("user:notification", user, oauth_token) -      {:ok, favorite_activity} = CommonAPI.favorite(user2, activity.id) +      {:ok, favorite_activity} = CommonAPI.favorite(activity.id, user2)        refute_receive _        assert Streamer.filtered_by_user?(user, favorite_activity) @@ -863,7 +863,7 @@ defmodule Pleroma.Web.StreamerTest do        {:ok, create_activity} = CommonAPI.post(user1, %{status: "I'm kawen"})        Streamer.get_topic_and_add_socket("user", user1, user1_token) -      {:ok, _favorite_activity} = CommonAPI.favorite(user2, create_activity.id) +      {:ok, _favorite_activity} = CommonAPI.favorite(create_activity.id, user2)        assert_receive {:render_with_user, _, "notification.json", notif, _}        refute Streamer.filtered_by_user?(user1, notif) | 
