mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-09 09:52:13 +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]
|
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
|
defp fetch_rich_media_for_activities(activities) do
|
||||||
Enum.each(activities, fn activity ->
|
Enum.each(activities, fn activity ->
|
||||||
spawn(fn -> Card.get_by_activity(activity) end)
|
Card.get_by_activity(activity)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -93,14 +93,6 @@ defmodule Pleroma.Web.RichMedia.Card do
|
||||||
end
|
end
|
||||||
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
|
@spec get_by_activity(Activity.t()) :: t() | nil | :error
|
||||||
# Fake/Draft activity
|
# Fake/Draft activity
|
||||||
def get_by_activity(%Activity{id: "pleroma:fakeid"} = activity) do
|
def get_by_activity(%Activity{id: "pleroma:fakeid"} = activity) do
|
||||||
|
|
Loading…
Reference in a new issue