),
{: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
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
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))
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
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
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
# 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
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
{:ok, data}
end
- def prepare_outgoing(%{"type" => type} = data) do
+ def prepare_outgoing(%{"type" => _type} = data) do
data =
data
|> maybe_fix_object_url
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
|> 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}",
end
defp collect_context_ids(activities) do
- contexts =
+ _contexts =
activities
|> Enum.reject(& &1.data["context_id"])
|> Enum.map(fn %{data: data} ->