Allow reacting with mixed unicode and custom emojis
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending

This commit is contained in:
Alexander Tumin 2022-12-21 17:41:26 +03:00
parent af7c3fab98
commit d11530f872
2 changed files with 17 additions and 3 deletions

View file

@ -90,8 +90,10 @@ defmodule Pleroma.Web.ActivityPub.Builder do
Enum.find(
existing_reactions,
fn [name, _, url] ->
url = URI.parse(url)
url.host == instance && name == emoji_code
if url != nil do
url = URI.parse(url)
url.host == instance && name == emoji_code
end
end
)

View file

@ -76,7 +76,12 @@ defmodule Pleroma.Web.PleromaAPI.EmojiReactionControllerTest do
note =
insert(:note,
user: user,
data: %{"reactions" => [["wow", [other_user.ap_id], "https://remote/emoji/wow"]]}
data: %{
"reactions" => [
["👍", [other_user.ap_id], nil],
["wow", [other_user.ap_id], "https://remote/emoji/wow"]
]
}
)
activity = insert(:note_activity, note: note, user: user)
@ -89,6 +94,13 @@ defmodule Pleroma.Web.PleromaAPI.EmojiReactionControllerTest do
|> json_response(200)
assert result["pleroma"]["emoji_reactions"] == [
%{
"account_ids" => [other_user.id],
"count" => 1,
"me" => false,
"name" => "👍",
"url" => nil
},
%{
"name" => "wow@remote",
"count" => 2,