Handle Fedibird's new quoteUri field
This commit is contained in:
parent
f89874596e
commit
32e284ed2c
6 changed files with 92 additions and 10 deletions
|
|
@ -78,7 +78,13 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do
|
|||
|
||||
defp fix_quote_url(%{"quoteUrl" => _quote_url} = data), do: data
|
||||
|
||||
# Fix for Fedibird
|
||||
# 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)
|
||||
|
|
|
|||
|
|
@ -180,7 +180,15 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
end
|
||||
end
|
||||
|
||||
# Fix for Fedibird
|
||||
# Fedibird
|
||||
# https://github.com/fedibird/mastodon/commit/dbd7ae6cf58a92ec67c512296b4daaea0d01e6ac
|
||||
def fix_quote_url(%{"quoteUri" => quote_url} = object, options) do
|
||||
object
|
||||
|> Map.put("quoteUrl", quote_url)
|
||||
|> fix_quote_url(options)
|
||||
end
|
||||
|
||||
# Old Fedibird (bug)
|
||||
# https://github.com/fedibird/mastodon/issues/9
|
||||
def fix_quote_url(%{"quoteURL" => quote_url} = object, options) do
|
||||
object
|
||||
|
|
@ -660,10 +668,13 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
|
||||
def set_reply_to_uri(obj), do: obj
|
||||
|
||||
# Misskey quotes
|
||||
# Despite being underscored, it's potentially more reliable for interop.
|
||||
def set_quote_url(%{"quoteUrl" => quote_url} = object) when is_binary(quote_url) do
|
||||
Map.put(object, "_misskey_quote", quote_url)
|
||||
Map.merge(object, %{
|
||||
# Fedibird quote
|
||||
"quoteUri" => quote_url,
|
||||
# Misskey quote
|
||||
"_misskey_quote" => quote_url
|
||||
})
|
||||
end
|
||||
|
||||
def set_quote_url(obj), do: obj
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue