Merge remote-tracking branch 'remotes/upstream/develop' into 1427-oauth-admin-scopes
[akkoma] / lib / pleroma / web / admin_api / views / report_view.ex
index 45ce75272c2d8d7f8171889324c47affd040b5d6..13602efd9f4d9612b6f6787f3226e8f77c63a5a1 100644 (file)
@@ -4,6 +4,7 @@
 
 defmodule Pleroma.Web.AdminAPI.ReportView do
   use Pleroma.Web, :view
+  alias Pleroma.Activity
   alias Pleroma.HTML
   alias Pleroma.User
   alias Pleroma.Web.AdminAPI.Report
@@ -46,15 +47,15 @@ defmodule Pleroma.Web.AdminAPI.ReportView do
     reports =
       Enum.map(groups, fn group ->
         status =
-          if group[:status_deleted],
-            do: group[:status],
-            else: StatusView.render("show.json", %{activity: group[:status]})
+          case group.status do
+            %Activity{} = activity -> StatusView.render("show.json", %{activity: activity})
+            _ -> group.status
+          end
 
         %{
           date: group[:date],
           account: group[:account],
-          status: status,
-          status_deleted: group[:status_deleted],
+          status: Map.put_new(status, "deleted", false),
           actors: Enum.map(group[:actors], &merge_account_views/1),
           reports:
             group[:reports]