Merge branch 'fix/reports-from-admins' into 'develop'
[akkoma] / lib / pleroma / notification.ex
index dd7a1c82405f6e8e8ed5fd926bfeb2d2e5a494b5..1970fbf65d1611ac907fdeaa78aa6f660404e5d2 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Notification do
@@ -115,7 +115,7 @@ defmodule Pleroma.Notification do
     |> where(
       [n, a],
       fragment(
-        "? not in (SELECT ap_id FROM users WHERE deactivated = 'true')",
+        "? not in (SELECT ap_id FROM users WHERE is_active = 'false')",
         a.actor
       )
     )
@@ -358,7 +358,7 @@ defmodule Pleroma.Notification do
   def create_notifications(activity, options \\ [])
 
   def create_notifications(%Activity{data: %{"to" => _, "type" => "Create"}} = activity, options) do
-    object = Object.normalize(activity, false)
+    object = Object.normalize(activity, fetch: false)
 
     if object && object.data["type"] == "Answer" do
       {:ok, []}
@@ -507,8 +507,8 @@ defmodule Pleroma.Notification do
     [object_id]
   end
 
-  def get_potential_receiver_ap_ids(%{data: %{"type" => "Flag"}}) do
-    User.all_superusers() |> Enum.map(fn user -> user.ap_id end)
+  def get_potential_receiver_ap_ids(%{data: %{"type" => "Flag", "actor" => actor}}) do
+    (User.all_superusers() |> Enum.map(fn user -> user.ap_id end)) -- [actor]
   end
 
   def get_potential_receiver_ap_ids(activity) do
@@ -625,7 +625,7 @@ defmodule Pleroma.Notification do
   def skip?(:filtered, %{data: %{"type" => type}}, _) when type in ["Follow", "Move"], do: false
 
   def skip?(:filtered, activity, user) do
-    object = Object.normalize(activity)
+    object = Object.normalize(activity, fetch: false)
 
     cond do
       is_nil(object) ->