Verified Commit 04709e1a authored by Alex Gleason's avatar Alex Gleason
Browse files

Transmogrifier: fix quoteUrl here too

parent fbdfeb32
Pipeline #38809 passed with stages
in 16 minutes and 8 seconds
......@@ -167,9 +167,9 @@ def fix_in_reply_to(%{"inReplyTo" => in_reply_to} = object, options)
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
......@@ -181,7 +181,22 @@ def fix_quote(%{"quoteUrl" => quote_url} = object, options)
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
......@@ -471,7 +486,7 @@ def handle_incoming(
|> 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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment