diff options
author | Alexander Tumin <iamtakingiteasy@eientei.org> | 2023-03-02 10:09:13 +0300 |
---|---|---|
committer | Alexander Tumin <iamtakingiteasy@eientei.org> | 2023-03-12 11:39:17 +0300 |
commit | 2c2ea16b50a7b77b1d3f58722e45720dcf3c51b9 (patch) | |
tree | 9641fe54d5c172d33bf2e40617f8919b5f71dc93 /test | |
parent | 8d3b29aaba1a1879c9495ae15178b6e16ffc5faf (diff) | |
download | pleroma-2c2ea16b50a7b77b1d3f58722e45720dcf3c51b9.tar.gz pleroma-2c2ea16b50a7b77b1d3f58722e45720dcf3c51b9.zip |
Allow custom emoji reactions: Add pleroma_custom_emoji_reactions feature, review changes
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/views/notification_view_test.exs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index e52985f8d..ddbe4557f 100644 --- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs @@ -197,6 +197,45 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do test_notifications_rendering([notification], user, [expected]) end + test "EmojiReact custom emoji notification" do + user = insert(:user) + other_user = insert(:user) + + note = + insert(:note, + user: user, + data: %{ + "reactions" => [ + ["👍", [user.ap_id], nil], + ["dinosaur", [user.ap_id], "http://localhost:4001/emoji/dino walking.gif"] + ] + } + ) + + activity = insert(:note_activity, note: note, user: user) + + {:ok, _activity} = CommonAPI.react_with_emoji(activity.id, other_user, "dinosaur") + + activity = Repo.get(Activity, activity.id) + + [notification] = Notification.for_user(user) + + assert notification + + expected = %{ + id: to_string(notification.id), + pleroma: %{is_seen: false, is_muted: false}, + type: "pleroma:emoji_reaction", + emoji: ":dinosaur:", + account: AccountView.render("show.json", %{user: other_user, for: user}), + status: StatusView.render("show.json", %{activity: activity, for: user}), + created_at: Utils.to_masto_date(notification.inserted_at), + emoji_url: "http://localhost:4001/emoji/dino walking.gif" + } + + test_notifications_rendering([notification], user, [expected]) + end + test "Poll notification" do user = insert(:user) activity = insert(:question_activity, user: user) |