1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-11-19 11:29:17 +00:00

More unused variables

This commit is contained in:
Mark Felder 2018-05-04 21:16:02 +00:00
parent 5855ffd322
commit 943820ae29
4 changed files with 15 additions and 15 deletions

View file

@ -66,7 +66,7 @@ def create(%{to: to, actor: actor, context: context, object: object} = params) d
),
{: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 @@ def delete(%Object{data: %{"id" => id, "actor" => actor}} = object, local \\ tru
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 @@ defp restrict_tag(query, %{"tag" => tag}) 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 @@ def fetch_and_prepare_user_from_ap_id(ap_id) 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 @@ def fetch_object_from_id(id) 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

View file

@ -156,12 +156,12 @@ def handle_incoming(
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 @@ def handle_incoming(
# 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 @@ def handle_incoming(
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 @@ def prepare_outgoing(%{"type" => "Create", "object" => %{"type" => "Note"} = obj
{: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 @@ def maybe_fix_object_url(data) 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

View file

@ -47,11 +47,11 @@ def render("user.json", %{user: user}) 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}",

View file

@ -31,7 +31,7 @@ defp query_users(user_ids) do
end
defp collect_context_ids(activities) do
contexts =
_contexts =
activities
|> Enum.reject(& &1.data["context_id"])
|> Enum.map(fn %{data: data} ->