AdminAPI: hotfix for nil report objects
authorAlex Gleason <alex@alexgleason.me>
Wed, 11 Aug 2021 14:38:16 +0000 (09:38 -0500)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 13 Aug 2021 15:57:39 +0000 (17:57 +0200)
Backport of: https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3504

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

index 05c05b81475b86e109b7d227e7a1249e157ee178..6cdb665d168b2c6cc437befe4556828a11729336 100644 (file)
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - MRF ObjectAgePolicy: Fix pattern matching on "published"
 - TwitterAPI: Make `change_password` and `change_email` require params on body instead of query
 - Subscription(Bell) Notifications: Don't create from Pipeline Ingested replies
+- AdminAPI: Fix rendering reports containing a `nil` object
 
 ## 2.4.0 - 2021-08-08
 
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)