mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-17 10:39:17 +00:00
No need to spawn() any more
This commit is contained in:
parent
ad52135bf5
commit
4d6fb43cbd
|
@ -26,12 +26,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
|
||||
import Pleroma.Web.ActivityPub.Visibility, only: [get_visibility: 1, visible_for_user?: 2]
|
||||
|
||||
# This is a naive way to do this, just spawning a process per activity
|
||||
# to fetch the preview. However it should be fine considering
|
||||
# pagination is restricted to 40 activities at a time
|
||||
defp fetch_rich_media_for_activities(activities) do
|
||||
Enum.each(activities, fn activity ->
|
||||
spawn(fn -> Card.get_by_activity(activity) end)
|
||||
Card.get_by_activity(activity)
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
@ -93,14 +93,6 @@ def get_or_backfill_by_url(url, backfill_opts \\ %{}) do
|
|||
end
|
||||
end
|
||||
|
||||
@spec get_by_object(Object.t()) :: t() | nil | :error
|
||||
def get_by_object(object) do
|
||||
case HTML.extract_first_external_url_from_object(object) do
|
||||
nil -> nil
|
||||
url -> get_or_backfill_by_url(url)
|
||||
end
|
||||
end
|
||||
|
||||
@spec get_by_activity(Activity.t()) :: t() | nil | :error
|
||||
# Fake/Draft activity
|
||||
def get_by_activity(%Activity{id: "pleroma:fakeid"} = activity) do
|
||||
|
|
Loading…
Reference in a new issue