From: Haelwenn (lanodan) Monnier Date: Mon, 21 Jan 2019 06:07:54 +0000 (+0100) Subject: Activity: create_activity_by_object_id_query/1 → create_by_object_ap_id/1 when is_list X-Git-Url: http://git.squeep.com/?a=commitdiff_plain;h=2fdbd4d137387d4d469d314b641070a9fdc0468c;p=akkoma Activity: create_activity_by_object_id_query/1 → create_by_object_ap_id/1 when is_list --- diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index 8c73d1fa0..5c3b8fcc5 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -63,7 +63,7 @@ defmodule Pleroma.Activity do ) end - def create_activity_by_object_id_query(ap_ids) do + def create_by_object_ap_id(ap_ids) when is_list(ap_ids) do from( activity in Activity, where: @@ -82,7 +82,7 @@ defmodule Pleroma.Activity do end def get_create_activity_by_object_ap_id(ap_id) when is_binary(ap_id) do - create_activity_by_object_id_query([ap_id]) + create_by_object_ap_id(ap_id) |> Repo.one() end diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 7f5a52ea3..5e9c5c533 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -25,7 +25,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do nil end) |> Enum.filter(& &1) - |> Activity.create_activity_by_object_id_query() + |> Activity.create_by_object_ap_id() |> Repo.all() |> Enum.reduce(%{}, fn activity, acc -> Map.put(acc, activity.data["object"]["id"], activity)