RichMedia: Respect configuration on status previews

This commit is contained in:
Haelwenn (lanodan) Monnier 2024-05-29 07:59:02 +02:00
parent 05b9805bf9
commit c16ef40f13
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

View file

View file

@ -104,7 +104,8 @@ defmodule Pleroma.Web.RichMedia.Card do
@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
with %Object{} = object <- Object.normalize(activity, fetch: false), with {_, true} <- {:config, @config_impl.get([:rich_media, :enabled])},
%Object{} = object <- Object.normalize(activity, fetch: false),
url when not is_nil(url) <- HTML.extract_first_external_url_from_object(object) do url when not is_nil(url) <- HTML.extract_first_external_url_from_object(object) do
case get_by_url(url) do case get_by_url(url) do
# Cache hit # Cache hit