+ alias Pleroma.Web.MediaProxy
+ alias Pleroma.Repo
+
+ # TODO: Add cached version.
+ defp get_replied_to_activities(activities) do
+ activities
+ |> Enum.map(fn
+ (%{data: %{"type" => "Create", "object" => %{"inReplyTo" => inReplyTo}}}) ->
+ (inReplyTo != "") && inReplyTo
+ _ -> nil
+ end)
+ |> Enum.filter(&(&1))
+ |> Activity.create_activity_by_object_id_query()
+ |> Repo.all
+ |> Enum.reduce(%{}, fn(activity, acc) -> Map.put(acc,activity.data["object"]["id"], activity) end)
+ end