Merge branch 'develop' into refactor/notification_settings
[akkoma] / lib / pleroma / notification.ex
index 32bcfcaba34d9c830211c3f8180481feff193b5d..0b171563b291873000182e7345711fb2939fc1d5 100644 (file)
@@ -571,10 +571,7 @@ defmodule Pleroma.Notification do
     [
       :self,
       :invisible,
-      :followers,
-      :follows,
-      :non_followers,
-      :non_follows,
+      :block_from_strangers,
       :recently_followed,
       :filtered
     ]
@@ -595,45 +592,15 @@ defmodule Pleroma.Notification do
   end
 
   def skip?(
-        :followers,
+        :block_from_strangers,
         %Activity{} = activity,
-        %User{notification_settings: %{followers: false}} = user
-      ) do
-    actor = activity.data["actor"]
-    follower = User.get_cached_by_ap_id(actor)
-    User.following?(follower, user)
-  end
-
-  def skip?(
-        :non_followers,
-        %Activity{} = activity,
-        %User{notification_settings: %{non_followers: false}} = user
+        %User{notification_settings: %{block_from_strangers: true}} = user
       ) do
     actor = activity.data["actor"]
     follower = User.get_cached_by_ap_id(actor)
     !User.following?(follower, user)
   end
 
-  def skip?(
-        :follows,
-        %Activity{} = activity,
-        %User{notification_settings: %{follows: false}} = user
-      ) do
-    actor = activity.data["actor"]
-    followed = User.get_cached_by_ap_id(actor)
-    User.following?(user, followed)
-  end
-
-  def skip?(
-        :non_follows,
-        %Activity{} = activity,
-        %User{notification_settings: %{non_follows: false}} = user
-      ) do
-    actor = activity.data["actor"]
-    followed = User.get_cached_by_ap_id(actor)
-    !User.following?(user, followed)
-  end
-
   # To do: consider defining recency in hours and checking FollowingRelationship with a single SQL
   def skip?(:recently_followed, %Activity{data: %{"type" => "Follow"}} = activity, %User{} = user) do
     actor = activity.data["actor"]