Admin API: Error when trying to update reports in the "old" format
authorMaxim Filippov <colixer@gmail.com>
Sat, 16 Nov 2019 09:44:48 +0000 (18:44 +0900)
committerMaxim Filippov <colixer@gmail.com>
Sat, 16 Nov 2019 09:44:48 +0000 (18:44 +0900)
CHANGELOG.md
lib/pleroma/web/activity_pub/utils.ex

index b4ad91b0d774c6f4843139779f8912310e37f4a4..740facf04d468c2f8de4871b9a37565ec24db802 100644 (file)
@@ -77,6 +77,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 
 - Mastodon API: Fix private and direct statuses not being filtered out from the public timeline for an authenticated user (`GET /api/v1/timelines/public`)
 - Mastodon API: Inability to get some local users by nickname in `/api/v1/accounts/:id_or_nickname`
+- Admin API: Error when trying to update reports in the "old" format
 </details>
 
 ## [1.1.2] - 2019-10-18
index c456623596b372c91084c06adde6ffb259592579..01aacbde3fbac90d68f08d12ed0497383d4ceb22 100644 (file)
@@ -903,7 +903,13 @@ defmodule Pleroma.Web.ActivityPub.Utils do
 
   def strip_report_status_data(activity) do
     [actor | reported_activities] = activity.data["object"]
-    stripped_activities = Enum.map(reported_activities, & &1["id"])
+
+    stripped_activities =
+      Enum.map(reported_activities, fn
+        act when is_map(act) -> act["id"]
+        act when is_binary(act) -> act
+      end)
+
     new_data = put_in(activity.data, ["object"], [actor | stripped_activities])
 
     {:ok, %{activity | data: new_data}}