mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
common api: make sure the generated IR is actually federatable
This commit is contained in:
parent
e7309d3b60
commit
71eff09e56
2 changed files with 10 additions and 2 deletions
|
@ -217,14 +217,16 @@ defmodule Pleroma.Web.CommonAPI do
|
||||||
{to, cc} <- get_to_and_cc(user, [], nil, visibility, nil),
|
{to, cc} <- get_to_and_cc(user, [], nil, visibility, nil),
|
||||||
listen_data <-
|
listen_data <-
|
||||||
Map.take(data, ["album", "artist", "title", "length"])
|
Map.take(data, ["album", "artist", "title", "length"])
|
||||||
|> Map.put("type", "Audio"),
|
|> Map.put("type", "Audio")
|
||||||
|
|> Map.put("to", to)
|
||||||
|
|> Map.put("cc", cc),
|
||||||
{:ok, activity} <-
|
{:ok, activity} <-
|
||||||
ActivityPub.listen(%{
|
ActivityPub.listen(%{
|
||||||
actor: user,
|
actor: user,
|
||||||
to: to,
|
to: to,
|
||||||
object: listen_data,
|
object: listen_data,
|
||||||
context: Utils.generate_context_id(),
|
context: Utils.generate_context_id(),
|
||||||
additional: %{cc: cc}
|
additional: %{"cc" => cc}
|
||||||
}) do
|
}) do
|
||||||
{:ok, activity}
|
{:ok, activity}
|
||||||
end
|
end
|
||||||
|
|
|
@ -1226,6 +1226,12 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
||||||
{:ok, modified} = Transmogrifier.prepare_outgoing(listen_activity.data)
|
{:ok, modified} = Transmogrifier.prepare_outgoing(listen_activity.data)
|
||||||
|
|
||||||
assert modified["type"] == "Listen"
|
assert modified["type"] == "Listen"
|
||||||
|
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
{:ok, activity} = CommonAPI.listen(user, %{"title" => "lain radio episode 1"})
|
||||||
|
|
||||||
|
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue