diff options
| author | Lain Soykaf <lain@soykaf.club> | 2020-07-22 14:44:06 +0200 | 
|---|---|---|
| committer | Lain Soykaf <lain@soykaf.club> | 2020-07-22 14:44:06 +0200 | 
| commit | 0cb9e1da746ee5bfb8147cead3944f0e13fb447f (patch) | |
| tree | 902dfce3dcd2770404c3edc8103f752e9828486c /test/web/mastodon_api | |
| parent | 96f023be5c3b6d41f610ceecd50320da2aacca8d (diff) | |
| download | pleroma-0cb9e1da746ee5bfb8147cead3944f0e13fb447f.tar.gz pleroma-0cb9e1da746ee5bfb8147cead3944f0e13fb447f.zip | |
StatusView: Handle badly formatted emoji reactions.
Diffstat (limited to 'test/web/mastodon_api')
| -rw-r--r-- | test/web/mastodon_api/views/status_view_test.exs | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/test/web/mastodon_api/views/status_view_test.exs b/test/web/mastodon_api/views/status_view_test.exs index fa26b3129..8791d3573 100644 --- a/test/web/mastodon_api/views/status_view_test.exs +++ b/test/web/mastodon_api/views/status_view_test.exs @@ -56,6 +56,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do             ]    end +  test "works correctly with badly formatted emojis" do +    user = insert(:user) +    {:ok, activity} = CommonAPI.post(user, %{status: "yo"}) + +    activity +    |> Object.normalize(false) +    |> Object.update_data(%{"reactions" => %{"☕" => [user.ap_id], "x" => 1}}) + +    activity = Activity.get_by_id(activity.id) + +    status = StatusView.render("show.json", activity: activity, for: user) + +    assert status[:pleroma][:emoji_reactions] == [ +             %{name: "☕", count: 1, me: true} +           ] +  end +    test "loads and returns the direct conversation id when given the `with_direct_conversation_id` option" do      user = insert(:user) | 
