utils: Fix maybe_splice_recipient when "object" isn’t a map

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-11-27 00:25:24 +01:00
commit 53193b84b1
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
3 changed files with 9 additions and 4 deletions

View file

@ -96,11 +96,11 @@ defmodule Pleroma.Web.ActivityPub.Utils do
!label_in_collection?(ap_id, params["cc"])
if need_splice? do
cc_list = extract_list(params["cc"])
cc = [ap_id | extract_list(params["cc"])]
params
|> Map.put("cc", [ap_id | cc_list])
|> Kernel.put_in(["object", "cc"], [ap_id | cc_list])
|> Map.put("cc", cc)
|> Maps.safe_put_in(["object", "cc"], cc)
else
params
end