More unused variables
authorMark Felder <feld@feld.me>
Fri, 4 May 2018 21:16:02 +0000 (21:16 +0000)
committerMark Felder <feld@feld.me>
Fri, 4 May 2018 21:16:02 +0000 (21:16 +0000)
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/transmogrifier.ex
lib/pleroma/web/activity_pub/views/user_view.ex
lib/pleroma/web/twitter_api/views/activity_view.ex

index 3ddc009a1d3fc517d5341942d77abc74ae01eead..fde6e12d78f712e3074cbddd0cf0f37bc2653731 100644 (file)
@@ -66,7 +66,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
            ),
          {:ok, activity} <- insert(create_data, local),
          :ok <- maybe_federate(activity),
-         {:ok, actor} <- User.increase_note_count(actor) do
+         {:ok, _actor} <- User.increase_note_count(actor) do
       {:ok, activity}
     end
   end
@@ -177,7 +177,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
          Repo.delete_all(Activity.all_non_create_by_object_ap_id_q(id)),
          {:ok, activity} <- insert(data, local),
          :ok <- maybe_federate(activity),
-         {:ok, actor} <- User.decrease_note_count(user) do
+         {:ok, _actor} <- User.decrease_note_count(user) do
       {:ok, activity}
     end
   end
@@ -236,7 +236,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
 
   defp restrict_tag(query, _), do: query
 
-  defp restrict_recipients(query, [], user), do: query
+  defp restrict_recipients(query, [], _user), do: query
 
   defp restrict_recipients(query, recipients, nil) do
     from(activity in query, where: fragment("? && ?", ^recipients, activity.recipients))
@@ -400,7 +400,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
   end
 
   def make_user_from_ap_id(ap_id) do
-    if user = User.get_by_ap_id(ap_id) do
+    if _user = User.get_by_ap_id(ap_id) do
       Transmogrifier.upgrade_user_from_ap_id(ap_id)
     else
       with {:ok, data} <- fetch_and_prepare_user_from_ap_id(ap_id) do
@@ -496,7 +496,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
         object = %Object{} ->
           {:ok, object}
 
-        e ->
+        _e ->
           Logger.info("Couldn't get object via AP, trying out OStatus fetching...")
 
           case OStatus.fetch_activity_from_url(id) do
index 221bc7dabb17cdf9f690cf66f4f944087fe767a4..da6562dcd0db531a5fec9891a34aa2a1ea1db8a8 100644 (file)
@@ -156,12 +156,12 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   end
 
   def handle_incoming(
-        %{"type" => "Announce", "object" => object_id, "actor" => actor, "id" => id} = data
+        %{"type" => "Announce", "object" => object_id, "actor" => actor, "id" => id} = _data
       ) do
     with %User{} = actor <- User.get_or_fetch_by_ap_id(actor),
          {:ok, object} <-
            get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id),
-         {:ok, activity, object} <- ActivityPub.announce(actor, object, id, false) do
+         {:ok, activity, _object} <- ActivityPub.announce(actor, object, id, false) do
       {:ok, activity}
     else
       _e -> :error
@@ -202,7 +202,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
 
   # TODO: Make secure.
   def handle_incoming(
-        %{"type" => "Delete", "object" => object_id, "actor" => actor, "id" => id} = data
+        %{"type" => "Delete", "object" => object_id, "actor" => actor, "id" => _id} = _data
       ) do
     object_id =
       case object_id do
@@ -210,13 +210,13 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
         id -> id
       end
 
-    with %User{} = actor <- User.get_or_fetch_by_ap_id(actor),
+    with %User{} = _actor <- User.get_or_fetch_by_ap_id(actor),
          {:ok, object} <-
            get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id),
          {:ok, activity} <- ActivityPub.delete(object, false) do
       {:ok, activity}
     else
-      e -> :error
+      _e -> :error
     end
   end
 
@@ -272,7 +272,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     {:ok, data}
   end
 
-  def prepare_outgoing(%{"type" => type} = data) do
+  def prepare_outgoing(%{"type" => _type} = data) do
     data =
       data
       |> maybe_fix_object_url
@@ -286,7 +286,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
       case ActivityPub.fetch_object_from_id(data["object"]) do
         {:ok, relative_object} ->
           if relative_object.data["external_url"] do
-            data =
+            _data =
               data
               |> Map.put("object", relative_object.data["external_url"])
           else
index 92afd0872091727412f7af9918fc2a11fa236773..733e5fb57aa4571240ffb92b7f80a2f8f275e863 100644 (file)
@@ -47,11 +47,11 @@ defmodule Pleroma.Web.ActivityPub.UserView do
     |> Map.merge(Utils.make_json_ld_header())
   end
 
-  def collection(collection, iri, page, total \\ nil) do
+  def collection(collection, iri, page, _total \\ nil) do
     offset = (page - 1) * 10
     items = Enum.slice(collection, offset, 10)
     items = Enum.map(items, fn user -> user.ap_id end)
-    total = total || length(collection)
+    _total = _total || length(collection)
 
     map = %{
       "id" => "#{iri}?page=#{page}",
index 4e4433aed5653e1186314473d3b7736dc2ec4422..580d4648cfd59f3d7bdea948faf73ad8e89bc31d 100644 (file)
@@ -31,7 +31,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
   end
 
   defp collect_context_ids(activities) do
-    contexts =
+    _contexts =
       activities
       |> Enum.reject(& &1.data["context_id"])
       |> Enum.map(fn %{data: data} ->