forked from AkkomaGang/akkoma
Prefer naming this function build_image_url/2
This commit is contained in:
parent
029ff65389
commit
b80f868c6b
1 changed files with 5 additions and 5 deletions
|
@ -386,7 +386,7 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
image_url = get_image_url(image_url_data, page_url_data)
|
image_url = build_image_url(image_url_data, page_url_data)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
type: "link",
|
type: "link",
|
||||||
|
@ -548,8 +548,8 @@ defp build_application(_), do: nil
|
||||||
# Avoid applying URI.merge unless necessary
|
# Avoid applying URI.merge unless necessary
|
||||||
# TODO: revert to always attempting URI.merge(image_url_data, page_url_data)
|
# TODO: revert to always attempting URI.merge(image_url_data, page_url_data)
|
||||||
# when Elixir 1.12 is the minimum supported version
|
# when Elixir 1.12 is the minimum supported version
|
||||||
@spec get_image_url(struct() | nil, struct()) :: String.t() | nil
|
@spec build_image_url(struct() | nil, struct()) :: String.t() | nil
|
||||||
defp get_image_url(
|
defp build_image_url(
|
||||||
%URI{scheme: image_scheme, host: image_host} = image_url_data,
|
%URI{scheme: image_scheme, host: image_host} = image_url_data,
|
||||||
%URI{} = _page_url_data
|
%URI{} = _page_url_data
|
||||||
)
|
)
|
||||||
|
@ -557,9 +557,9 @@ defp get_image_url(
|
||||||
image_url_data |> to_string
|
image_url_data |> to_string
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_image_url(%URI{} = image_url_data, %URI{} = page_url_data) do
|
defp build_image_url(%URI{} = image_url_data, %URI{} = page_url_data) do
|
||||||
URI.merge(page_url_data, image_url_data) |> to_string
|
URI.merge(page_url_data, image_url_data) |> to_string
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_image_url(_, _), do: nil
|
defp build_image_url(_, _), do: nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue