Remove duplicated code

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-05-14 16:44:23 +02:00
parent 3720c4ac22
commit aceff8c128
2 changed files with 2 additions and 24 deletions

View file

@ -445,8 +445,8 @@
ignore_hosts: [], ignore_hosts: [],
ignore_tld: ["local", "localdomain", "lan"], ignore_tld: ["local", "localdomain", "lan"],
parsers: [ parsers: [
Pleroma.Web.RichMedia.Parsers.OEmbed, Pleroma.Web.RichMedia.Parsers.TwitterCard,
Pleroma.Web.RichMedia.Parsers.TwitterCard Pleroma.Web.RichMedia.Parsers.OEmbed
], ],
oembed_providers_enabled: true, oembed_providers_enabled: true,
failure_backoff: 60_000, failure_backoff: 60_000,

View file

@ -71,27 +71,6 @@ defp fix_replies(%{"replies" => replies} = data) when not is_list(replies),
defp fix_replies(data), do: data defp fix_replies(data), do: data
defp fix_quote_url(%{"quoteUrl" => _quote_url} = data), do: data
# Fedibird
# https://github.com/fedibird/mastodon/commit/dbd7ae6cf58a92ec67c512296b4daaea0d01e6ac
defp fix_quote_url(%{"quoteUri" => quote_url} = data) do
Map.put(data, "quoteUrl", quote_url)
end
# Old Fedibird (bug)
# https://github.com/fedibird/mastodon/issues/9
defp fix_quote_url(%{"quoteURL" => quote_url} = data) do
Map.put(data, "quoteUrl", quote_url)
end
# Misskey fallback
defp fix_quote_url(%{"_misskey_quote" => quote_url} = data) do
Map.put(data, "quoteUrl", quote_url)
end
defp fix_quote_url(data), do: data
def fix_attachments(%{"attachment" => attachment} = data) when is_map(attachment), def fix_attachments(%{"attachment" => attachment} = data) when is_map(attachment),
do: Map.put(data, "attachment", [attachment]) do: Map.put(data, "attachment", [attachment])
@ -104,7 +83,6 @@ defp fix(data) do
|> fix_url() |> fix_url()
|> fix_tag() |> fix_tag()
|> fix_replies() |> fix_replies()
|> fix_quote_url()
|> fix_attachments() |> fix_attachments()
|> CommonFixes.fix_quote_url() |> CommonFixes.fix_quote_url()
|> Transmogrifier.fix_emoji() |> Transmogrifier.fix_emoji()