Fix emoji reactions for legacy 2-tuple formats

This commit is contained in:
tusooa 2023-03-26 15:12:40 -04:00
commit c5d946bc92
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
8 changed files with 147 additions and 14 deletions

View file

@ -74,6 +74,27 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
]
end
test "works with legacy-formatted reactions" do
user = insert(:user)
other_user = insert(:user)
note =
insert(:note,
user: user,
data: %{
"reactions" => [["😿", [other_user.ap_id]]]
}
)
activity = insert(:note_activity, user: user, note: note)
status = StatusView.render("show.json", activity: activity, for: user)
assert status[:pleroma][:emoji_reactions] == [
%{name: "😿", count: 1, me: false, url: nil, account_ids: [other_user.id]}
]
end
test "works correctly with badly formatted emojis" do
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{status: "yo"})