ActivityPubControllerTest: Apply same addr changes to object

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-09-15 18:18:57 +02:00
parent 96212b2e32
commit d1205406d9
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
2 changed files with 26 additions and 9 deletions

View File

@ -97,7 +97,10 @@ def maybe_splice_recipient(ap_id, params) do
if need_splice? do
cc_list = extract_list(params["cc"])
Map.put(params, "cc", [ap_id | cc_list])
params
|> Map.put("cc", [ap_id | cc_list])
|> Kernel.put_in(["object", "cc"], [ap_id | cc_list])
else
params
end

View File

@ -649,7 +649,11 @@ test "without valid signature, " <>
test "it inserts an incoming activity into the database", %{conn: conn, data: data} do
user = insert(:user)
data = Map.put(data, "bcc", [user.ap_id])
data =
data
|> Map.put("bcc", [user.ap_id])
|> Kernel.put_in(["object", "bcc"], [user.ap_id])
conn =
conn
@ -666,8 +670,11 @@ test "it accepts messages with to as string instead of array", %{conn: conn, dat
user = insert(:user)
data =
Map.put(data, "to", user.ap_id)
|> Map.delete("cc")
data
|> Map.put("to", user.ap_id)
|> Map.put("cc", [])
|> Kernel.put_in(["object", "to"], user.ap_id)
|> Kernel.put_in(["object", "cc"], [])
conn =
conn
@ -684,8 +691,11 @@ test "it accepts messages with cc as string instead of array", %{conn: conn, dat
user = insert(:user)
data =
Map.put(data, "cc", user.ap_id)
|> Map.delete("to")
data
|> Map.put("to", [])
|> Map.put("cc", user.ap_id)
|> Kernel.put_in(["object", "to"], [])
|> Kernel.put_in(["object", "cc"], user.ap_id)
conn =
conn
@ -703,9 +713,13 @@ test "it accepts messages with bcc as string instead of array", %{conn: conn, da
user = insert(:user)
data =
Map.put(data, "bcc", user.ap_id)
|> Map.delete("to")
|> Map.delete("cc")
data
|> Map.put("to", [])
|> Map.put("cc", [])
|> Map.put("bcc", user.ap_id)
|> Kernel.put_in(["object", "to"], [])
|> Kernel.put_in(["object", "cc"], [])
|> Kernel.put_in(["object", "bcc"], user.ap_id)
conn =
conn