summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Tumin <iamtakingiteasy@eientei.org>2023-01-04 21:13:51 +0300
committerAlexander Tumin <iamtakingiteasy@eientei.org>2023-03-02 11:18:16 +0300
commit8d3b29aaba1a1879c9495ae15178b6e16ffc5faf (patch)
treea1b549d4b092257d1838de93021c7a9d81396b32
parent4b85d1c617e0d3d482dffe59e43c69d717d5a13f (diff)
downloadpleroma-8d3b29aaba1a1879c9495ae15178b6e16ffc5faf.tar.gz
pleroma-8d3b29aaba1a1879c9495ae15178b6e16ffc5faf.zip
Allow custom emoji reactions: add test for mixed emoji react, fix credo errors
-rw-r--r--lib/pleroma/web/mastodon_api/views/notification_view.ex2
-rw-r--r--test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs14
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/notification_view.ex b/lib/pleroma/web/mastodon_api/views/notification_view.ex
index 314246d3e..2a51f3755 100644
--- a/lib/pleroma/web/mastodon_api/views/notification_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/notification_view.ex
@@ -14,10 +14,10 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do
alias Pleroma.Web.AdminAPI.Report
alias Pleroma.Web.AdminAPI.ReportView
alias Pleroma.Web.CommonAPI
- alias Pleroma.Web.MediaProxy
alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.MastodonAPI.NotificationView
alias Pleroma.Web.MastodonAPI.StatusView
+ alias Pleroma.Web.MediaProxy
alias Pleroma.Web.PleromaAPI.Chat.MessageReferenceView
defp object_id_for(%{data: %{"object" => %{"id" => id}}}) when is_binary(id), do: id
diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs
index 6af68cb52..d81b47a6b 100644
--- a/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs
@@ -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)
@@ -90,6 +95,13 @@ defmodule Pleroma.Web.PleromaAPI.EmojiReactionControllerTest do
assert result["pleroma"]["emoji_reactions"] == [
%{
+ "account_ids" => [other_user.id],
+ "count" => 1,
+ "me" => false,
+ "name" => "👍",
+ "url" => nil
+ },
+ %{
"name" => "wow@remote",
"count" => 2,
"me" => true,