From: Mark Felder Date: Fri, 4 May 2018 21:16:02 +0000 (+0000) Subject: More unused variables X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=943820ae295dc52b2cf43ebb539093e24390edba;p=akkoma More unused variables --- diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 3ddc009a1..fde6e12d7 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -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 diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 221bc7dab..da6562dcd 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -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 diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index 92afd0872..733e5fb57 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -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}", diff --git a/lib/pleroma/web/twitter_api/views/activity_view.ex b/lib/pleroma/web/twitter_api/views/activity_view.ex index 4e4433aed..580d4648c 100644 --- a/lib/pleroma/web/twitter_api/views/activity_view.ex +++ b/lib/pleroma/web/twitter_api/views/activity_view.ex @@ -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} ->