forked from AkkomaGang/akkoma
Transmogrifier: Extend misskey like compatibility.
This commit is contained in:
parent
43a211bcb1
commit
6a85f7d1ea
2 changed files with 22 additions and 2 deletions
|
@ -570,7 +570,8 @@ def handle_incoming(
|
||||||
"angry" => "💢",
|
"angry" => "💢",
|
||||||
"confused" => "😥",
|
"confused" => "😥",
|
||||||
"rip" => "😇",
|
"rip" => "😇",
|
||||||
"pudding" => "🍮"
|
"pudding" => "🍮",
|
||||||
|
"star" => "⭐"
|
||||||
}
|
}
|
||||||
|
|
||||||
@doc "Rewrite misskey likes into EmojiReactions"
|
@doc "Rewrite misskey likes into EmojiReactions"
|
||||||
|
@ -583,7 +584,7 @@ def handle_incoming(
|
||||||
) do
|
) do
|
||||||
data
|
data
|
||||||
|> Map.put("type", "EmojiReaction")
|
|> Map.put("type", "EmojiReaction")
|
||||||
|> Map.put("content", @misskey_reactions[reaction])
|
|> Map.put("content", @misskey_reactions[reaction] || reaction)
|
||||||
|> handle_incoming(options)
|
|> handle_incoming(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -359,6 +359,25 @@ test "it works for incoming misskey likes, turning them into EmojiReactions" do
|
||||||
assert data["content"] == "🍮"
|
assert data["content"] == "🍮"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it works for incoming misskey likes that contain unicode emojis, turning them into EmojiReactions" do
|
||||||
|
user = insert(:user)
|
||||||
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "hello"})
|
||||||
|
|
||||||
|
data =
|
||||||
|
File.read!("test/fixtures/misskey-like.json")
|
||||||
|
|> Poison.decode!()
|
||||||
|
|> Map.put("object", activity.data["object"])
|
||||||
|
|> Map.put("_misskey_reaction", "⭐")
|
||||||
|
|
||||||
|
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
|
||||||
|
|
||||||
|
assert data["actor"] == data["actor"]
|
||||||
|
assert data["type"] == "EmojiReaction"
|
||||||
|
assert data["id"] == data["id"]
|
||||||
|
assert data["object"] == activity.data["object"]
|
||||||
|
assert data["content"] == "⭐"
|
||||||
|
end
|
||||||
|
|
||||||
test "it works for incoming emoji reactions" do
|
test "it works for incoming emoji reactions" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "hello"})
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "hello"})
|
||||||
|
|
Loading…
Reference in a new issue