refactor emoji api with fixes
[akkoma] / lib / pleroma / notification.ex
index b76dd176c0be6c5b9bfe9121f6f79ce694d67b7b..aaa67525366c0aca362970525eb366e2403ba696 100644 (file)
@@ -283,8 +283,17 @@ defmodule Pleroma.Notification do
     end
   end
 
+  def create_notifications(%Activity{data: %{"type" => "Follow"}} = activity) do
+    if Pleroma.Config.get([:notifications, :enable_follow_request_notifications]) ||
+         Activity.follow_accepted?(activity) do
+      do_create_notifications(activity)
+    else
+      {:ok, []}
+    end
+  end
+
   def create_notifications(%Activity{data: %{"type" => type}} = activity)
-      when type in ["Like", "Announce", "Follow", "Move", "EmojiReact"] do
+      when type in ["Like", "Announce", "Move", "EmojiReact"] do
     do_create_notifications(activity)
   end
 
@@ -353,7 +362,7 @@ defmodule Pleroma.Notification do
 
   def get_notified_from_activity(_, _local_only), do: {[], []}
 
-  @doc "Filters out AP IDs of users who domain-block and not follow activity actor"
+  @doc "Filters out AP IDs domain-blocking and not following the activity's actor"
   def exclude_domain_blocker_ap_ids(ap_ids, activity, preloaded_users \\ [])
 
   def exclude_domain_blocker_ap_ids([], _activity, _preloaded_users), do: []