diff options
author | lain <lain@soykaf.club> | 2020-05-07 12:43:30 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-05-07 12:43:30 +0200 |
commit | f57fa2a00df2d93eba53c1ff3ab5c7d5fabb8308 (patch) | |
tree | 75851b816d4195da3094f25cb07a561903f97463 /test | |
parent | 4c92dfb73ef1f40438adf5da009499205a677912 (diff) | |
download | pleroma-f57fa2a00df2d93eba53c1ff3ab5c7d5fabb8308.tar.gz |
Notifications: Simplify recipient calculation for some Activities.
Fixes the 'getting notfications for other people's posts' bug.
Diffstat (limited to 'test')
-rw-r--r-- | test/notification_test.exs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/notification_test.exs b/test/notification_test.exs index 5c85f3368..509ca0b0b 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 @@ -601,6 +603,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) |