diff options
author | Alex Gleason <alex@alexgleason.me> | 2022-01-22 19:14:39 -0600 |
---|---|---|
committer | tusooa <tusooa@kazv.moe> | 2023-09-13 19:19:03 -0400 |
commit | cc4badaf60462fdb8bb57225437e3dd360ee0dfb (patch) | |
tree | 96b9e65e2446d5a3aca3c35ca69bbbf10678ee05 | |
parent | b022d6635dad4b2769fbf1fd4b97f77a4cc646b4 (diff) | |
download | pleroma-cc4badaf60462fdb8bb57225437e3dd360ee0dfb.tar.gz pleroma-cc4badaf60462fdb8bb57225437e3dd360ee0dfb.zip |
Transmogrifier: fix quoteUrl here too
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index c466271ca..f5771e75e 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -166,9 +166,9 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do def fix_in_reply_to(object, _options), do: object - def fix_quote(object, options \\ []) + def fix_quote_url(object, options \\ []) - def fix_quote(%{"quoteUrl" => quote_url} = object, options) + def fix_quote_url(%{"quoteUrl" => quote_url} = object, options) when not is_nil(quote_url) do with {:ok, quoted_object} <- get_obj_helper(quote_url, options), %Activity{} <- Activity.get_create_by_object_ap_id(quoted_object.data["id"]) do @@ -180,7 +180,22 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do end end - def fix_quote(object, _options), do: object + # Fix for Fedibird + # https://github.com/fedibird/mastodon/issues/9 + def fix_quote_url(%{"quoteURL" => quote_url} = object, options) do + object + |> Map.put("quoteUrl", quote_url) + |> fix_quote_url(options) + end + + # Misskey fallback + def fix_quote_url(%{"_misskey_quote" => quote_url} = object, options) do + object + |> Map.put("quoteUrl", quote_url) + |> fix_quote_url(options) + end + + def fix_quote_url(object, _options), do: object defp prepare_in_reply_to(in_reply_to) do cond do @@ -470,7 +485,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do |> strip_internal_fields() |> fix_type(fetch_options) |> fix_in_reply_to(fetch_options) - |> fix_quote(fetch_options) + |> fix_quote_url(fetch_options) data = Map.put(data, "object", object) options = Keyword.put(options, :local, false) |