summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortusooa <tusooa@kazv.moe>2023-01-18 18:36:52 -0500
committertusooa <tusooa@kazv.moe>2023-02-20 12:21:27 -0500
commit3ab34048172f9fd99ad106d71b4e7ae5c57ab9e1 (patch)
treed195bc9b65429fde5120d46102bf908130b37acb /test
parentd5125e6ce75ee9c2cf54e5399625d7a94e313571 (diff)
downloadpleroma-3ab34048172f9fd99ad106d71b4e7ae5c57ab9e1.tar.gz
pleroma-3ab34048172f9fd99ad106d71b4e7ae5c57ab9e1.zip
Fix block_from_stranger setting
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/notification_test.exs26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs
index 255097ed0..d169ab709 100644
--- a/test/pleroma/notification_test.exs
+++ b/test/pleroma/notification_test.exs
@@ -334,6 +334,32 @@ defmodule Pleroma.NotificationTest do
refute Notification.create_notification(activity, followed)
end
+ test "it disables notifications from non-followees" do
+ follower = insert(:user)
+
+ followed =
+ insert(:user,
+ notification_settings: %Pleroma.User.NotificationSetting{block_from_strangers: true}
+ )
+
+ CommonAPI.follow(follower, followed)
+ {:ok, activity} = CommonAPI.post(follower, %{status: "hey @#{followed.nickname}"})
+ refute Notification.create_notification(activity, followed)
+ end
+
+ test "it allows notifications from followees" do
+ poster = insert(:user)
+
+ receiver =
+ insert(:user,
+ notification_settings: %Pleroma.User.NotificationSetting{block_from_strangers: true}
+ )
+
+ CommonAPI.follow(receiver, poster)
+ {:ok, activity} = CommonAPI.post(poster, %{status: "hey @#{receiver.nickname}"})
+ assert Notification.create_notification(activity, receiver)
+ end
+
test "it doesn't create a notification for user if he is the activity author" do
activity = insert(:note_activity)
author = User.get_cached_by_ap_id(activity.data["actor"])