Merge branch 'bugfix/status-search-fallback' into 'develop'
authorrinpatch <rin@patch.cx>
Fri, 13 Aug 2021 12:09:39 +0000 (12:09 +0000)
committerrinpatch <rin@patch.cx>
Fri, 13 Aug 2021 12:09:39 +0000 (12:09 +0000)
Activity.Search: resolve status on DB Timeout

Closes #2566

See merge request pleroma/pleroma!3507

CHANGELOG.md
lib/pleroma/web/admin_api/report.ex
lib/pleroma/web/common_api/utils.ex

index 421b6e04312cdf3bb19362b628f307663a345b40..231cac990c0c82f38313f0c5bb56aee656472884 100644 (file)
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 ### Added
 
 ### Fixed
+- Subscription(Bell) Notifications: Don't create from Pipeline Ingested replies
 
 ### Removed
 
index 259068f048b6488b6e8f7aa5997ca1f968200531..345bc1e87de62ef0d32a84efa0b30fcffb423407 100644 (file)
@@ -13,7 +13,9 @@ defmodule Pleroma.Web.AdminAPI.Report do
     account = User.get_cached_by_ap_id(account_ap_id)
 
     statuses =
-      Enum.map(status_ap_ids, fn
+      status_ap_ids
+      |> Enum.reject(&is_nil(&1))
+      |> Enum.map(fn
         act when is_map(act) -> Activity.get_by_ap_id_with_object(act["id"])
         act when is_binary(act) -> Activity.get_by_ap_id_with_object(act)
       end)
index 33639e6954fb54f51473fb9926c02c2f56b56239..10eb48250e9fb63a4d5f17536fe54cf74743adfa 100644 (file)
@@ -412,19 +412,14 @@ defmodule Pleroma.Web.CommonAPI.Utils do
 
   def maybe_notify_mentioned_recipients(recipients, _), do: recipients
 
-  # Do not notify subscribers if author is making a reply
-  def maybe_notify_subscribers(recipients, %Activity{
-        object: %Object{data: %{"inReplyTo" => _ap_id}}
-      }) do
-    recipients
-  end
-
   def maybe_notify_subscribers(
         recipients,
-        %Activity{data: %{"actor" => actor, "type" => type}} = activity
-      )
-      when type == "Create" do
-    with %User{} = user <- User.get_cached_by_ap_id(actor) do
+        %Activity{data: %{"actor" => actor, "type" => "Create"}} = activity
+      ) do
+    # Do not notify subscribers if author is making a reply
+    with %Object{data: object} <- Object.normalize(activity, fetch: false),
+         nil <- object["inReplyTo"],
+         %User{} = user <- User.get_cached_by_ap_id(actor) do
       subscriber_ids =
         user
         |> User.subscriber_users()