Poll notification: notify for polls even when block_from_strangers is set
authorAlex Gleason <alex@alexgleason.me>
Sun, 18 Jul 2021 15:48:37 +0000 (10:48 -0500)
committerAlex Gleason <alex@alexgleason.me>
Sun, 18 Jul 2021 16:10:04 +0000 (11:10 -0500)
lib/pleroma/notification.ex

index 43a0e8f49aaac708e64d102e495cc6225bbac0e1..4a6e5d3f931c58b67dbcfcdd80a2cb18203243ba 100644 (file)
@@ -631,11 +631,17 @@ defmodule Pleroma.Notification do
         :block_from_strangers,
         %Activity{} = activity,
         %User{notification_settings: %{block_from_strangers: true}} = user,
-        _opts
+        opts
       ) do
     actor = activity.data["actor"]
     follower = User.get_cached_by_ap_id(actor)
-    !User.following?(follower, user)
+
+    cond do
+      opts[:type] == "poll" -> false
+      user.ap_id == actor -> false
+      !User.following?(follower, user) -> true
+      true -> false
+    end
   end
 
   # To do: consider defining recency in hours and checking FollowingRelationship with a single SQL