From 2fdbd4d137387d4d469d314b641070a9fdc0468c Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 21 Jan 2019 07:07:54 +0100 Subject: [PATCH] =?UTF-8?q?Activity:=20create=5Factivity=5Fby=5Fobject=5Fi?= =?UTF-8?q?d=5Fquery/1=20=E2=86=92=20create=5Fby=5Fobject=5Fap=5Fid/1=20wh?= =?UTF-8?q?en=20is=5Flist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pleroma/activity.ex | 4 ++-- lib/pleroma/web/mastodon_api/views/status_view.ex | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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)