Verified Commit ac3426cb authored by Alex Gleason's avatar Alex Gleason
Browse files

Transmogrifier: federate quotes with _misskey_quote field

parent 5134e691
Pipeline #38902 passed with stages
in 9 minutes and 46 seconds
......@@ -661,6 +661,14 @@ def set_reply_to_uri(%{"inReplyTo" => in_reply_to} = object) when is_binary(in_r
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)
end
def set_quote_url(obj), do: obj
@doc """
Serialized Mastodon-compatible `replies` collection containing _self-replies_.
Based on Mastodon's ActivityPub::NoteSerializer#replies.
......@@ -715,6 +723,7 @@ def prepare_object(object) do
|> prepare_attachments
|> set_conversation
|> set_reply_to_uri
|> set_quote_url
|> set_replies
|> strip_internal_fields
|> strip_internal_tags
......
......@@ -17,6 +17,7 @@
"ostatus": "http://ostatus.org#",
"schema": "http://schema.org#",
"toot": "http://joinmastodon.org/ns#",
"misskey": "https://misskey-hub.net/ns#",
"value": "schema:value",
"sensitive": "as:sensitive",
"litepub": "http://litepub.social/ns#",
......@@ -27,6 +28,7 @@
"@type": "@id"
},
"quoteUrl": "as:quoteUrl",
"_misskey_quote": "misskey:_misskey_quote",
"oauthRegistrationEndpoint": {
"@id": "litepub:oauthRegistrationEndpoint",
"@type": "@id"
......
......@@ -333,7 +333,11 @@ test "it prepares a quote post" do
{:ok, modified} = Transmogrifier.prepare_outgoing(quote_post.data)
quoted_post = Object.normalize(quoted_post)
assert modified["object"]["quoteUrl"] == quoted_post.data["id"]
# Add Misskey's quote as a fallback
assert modified["object"]["_misskey_quote"] == quoted_post.data["id"]
end
end
......
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