summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2023-02-09 19:09:23 +0000
committerlain <lain@soykaf.club>2023-02-09 19:09:23 +0000
commit4d3c2fb21b2ec1a80d6a3076f1044f572dfcc4c6 (patch)
tree04449eb78dca9ec36a55b6e449970e7a56eebb81 /test
parent16276c8f872a43b8d30f2918ec92283e484b0b6a (diff)
parent7467b24730657e33c1f88627ef5609a3c9bd742e (diff)
downloadpleroma-4d3c2fb21b2ec1a80d6a3076f1044f572dfcc4c6.tar.gz
pleroma-4d3c2fb21b2ec1a80d6a3076f1044f572dfcc4c6.zip
Merge branch 'tusooa/notif-setting' into 'develop'
Fix block_from_stranger setting See merge request pleroma/pleroma!3833
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"])