summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-05-08 15:00:43 +0000
committerrinpatch <rinpatch@sdf.org>2020-05-08 15:00:43 +0000
commit570940a3fd8d5a2fb600656432dfc01304161221 (patch)
tree036b218fd0381f0f91655a3458c5cc4dd41fd314 /test
parentfbcc53760e6fcd393513c05a5bd7a4a6a6f3b731 (diff)
parent8ae4d64d475405f8ff98868b80fc71fbe74b45bc (diff)
downloadpleroma-570940a3fd8d5a2fb600656432dfc01304161221.tar.gz
pleroma-570940a3fd8d5a2fb600656432dfc01304161221.zip
Merge branch 'bugfix/fix-like-notifications' into 'develop'
Notifications: Simplify recipient calculation for some Activities. See merge request pleroma/pleroma!2486
Diffstat (limited to 'test')
-rw-r--r--test/notification_test.exs24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/notification_test.exs b/test/notification_test.exs
index 0783c325d..24e5f0c73 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -12,6 +12,8 @@ defmodule Pleroma.NotificationTest do
alias Pleroma.Notification
alias Pleroma.Tests.ObanHelpers
alias Pleroma.User
+ alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.Transmogrifier
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.MastodonAPI.NotificationView
@@ -614,6 +616,28 @@ defmodule Pleroma.NotificationTest do
assert other_user not in enabled_receivers
end
+ test "it only notifies the post's author in likes" do
+ user = insert(:user)
+ other_user = insert(:user)
+ third_user = insert(:user)
+
+ {:ok, activity_one} =
+ CommonAPI.post(user, %{
+ "status" => "hey @#{other_user.nickname}!"
+ })
+
+ {:ok, like_data, _} = Builder.like(third_user, activity_one.object)
+
+ {:ok, like, _} =
+ like_data
+ |> Map.put("to", [other_user.ap_id | like_data["to"]])
+ |> ActivityPub.persist(local: true)
+
+ {enabled_receivers, _disabled_receivers} = Notification.get_notified_from_activity(like)
+
+ assert other_user not in enabled_receivers
+ end
+
test "it does not send notification to mentioned users in announces" do
user = insert(:user)
other_user = insert(:user)