From aceff8c128ac8bd88fdaac7250644c1878768443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 14 May 2024 16:44:23 +0200 Subject: [PATCH] Remove duplicated code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- config/config.exs | 4 ++-- .../article_note_page_validator.ex | 22 ------------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/config/config.exs b/config/config.exs index a551233c06..518d6bede1 100644 --- a/config/config.exs +++ b/config/config.exs @@ -445,8 +445,8 @@ ignore_hosts: [], ignore_tld: ["local", "localdomain", "lan"], 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, failure_backoff: 60_000, diff --git a/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex b/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex index b80ec5d37a..4e27284aa7 100644 --- a/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex @@ -71,27 +71,6 @@ defp fix_replies(%{"replies" => replies} = data) when not is_list(replies), 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), do: Map.put(data, "attachment", [attachment]) @@ -104,7 +83,6 @@ defp fix(data) do |> fix_url() |> fix_tag() |> fix_replies() - |> fix_quote_url() |> fix_attachments() |> CommonFixes.fix_quote_url() |> Transmogrifier.fix_emoji()