Fix unfollows
[akkoma] / lib / pleroma / web / twitter_api / twitter_api.ex
index b6ae7c7f70f285ee01c2e1d8168eeb4b51e02ab6..722e436e22e7f23b7aa16c75bfa7f489804bb53d 100644 (file)
@@ -1,7 +1,6 @@
 defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
   alias Pleroma.{User, Activity, Repo, Object}
   alias Pleroma.Web.ActivityPub.ActivityPub
-  alias Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter
   alias Pleroma.Web.TwitterAPI.UserView
   alias Pleroma.Web.{OStatus, CommonAPI}
   import Ecto.Query
@@ -14,7 +13,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
 
   def delete(%User{} = user, id) do
     # TwitterAPI does not have an "unretweet" endpoint; instead this is done
-    # via the "destroy" endpoint.  Therefore, there is a need to handle
+    # via the "destroy" endpoint.  Therefore, we need to handle
     # when the status to "delete" is actually an Announce (repeat) object.
     with %Activity{data: %{"type" => type}} <- Repo.get(Activity, id) do
       case type do
@@ -83,14 +82,14 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
   end
 
   def fav(%User{} = user, ap_id_or_id) do
-    with {:ok, _announce, %{data: %{"id" => id}}} = CommonAPI.favorite(ap_id_or_id, user),
+    with {:ok, _fav, %{data: %{"id" => id}}} = CommonAPI.favorite(ap_id_or_id, user),
          %Activity{} = activity <- Activity.get_create_activity_by_object_ap_id(id) do
       {:ok, activity}
     end
   end
 
   def unfav(%User{} = user, ap_id_or_id) do
-    with {:ok, %{data: %{"id" => id}}} = CommonAPI.unfavorite(ap_id_or_id, user),
+    with {:ok, _unfav, _fav, %{data: %{"id" => id}}} = CommonAPI.unfavorite(ap_id_or_id, user),
          %Activity{} = activity <- Activity.get_create_activity_by_object_ap_id(id) do
       {:ok, activity}
     end
@@ -202,7 +201,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
 
   defp parse_int(_, default), do: default
 
-  def search(user, %{"q" => query} = params) do
+  def search(_user, %{"q" => query} = params) do
     limit = parse_int(params["rpp"], 20)
     page = parse_int(params["page"], 1)
     offset = (page - 1) * limit
@@ -224,7 +223,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
         order_by: [desc: :inserted_at]
       )
 
-    activities = Repo.all(q)
+    _activities = Repo.all(q)
   end
 
   defp make_date do