Update comment for prepare_object, rename prepare_outgoing
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
parent
ec6ffa4fdf
commit
2e80c786bb
14 changed files with 51 additions and 50 deletions
1
changelog.d/update-comment.ignore
Normal file
1
changelog.d/update-comment.ignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
Update comment for prepare_object, rename prepare_outgoing
|
||||
|
|
@ -342,7 +342,7 @@ defmodule Pleroma.User.Backup do
|
|||
dir,
|
||||
"outbox",
|
||||
fn a ->
|
||||
with {:ok, activity} <- Transmogrifier.prepare_outgoing(a.data) do
|
||||
with {:ok, activity} <- Transmogrifier.prepare_activity(a.data) do
|
||||
{:ok, Map.delete(activity, "@context")}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
|
|||
Determine if an activity can be represented by running it through Transmogrifier.
|
||||
"""
|
||||
def representable?(%Activity{} = activity) do
|
||||
with {:ok, _data} <- @transmogrifier_impl.prepare_outgoing(activity.data) do
|
||||
with {:ok, _data} <- @transmogrifier_impl.prepare_activity(activity.data) do
|
||||
true
|
||||
else
|
||||
_e ->
|
||||
|
|
@ -102,14 +102,14 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
|
|||
Logger.debug("Federating #{ap_id} to #{inbox}")
|
||||
uri = %{path: path} = URI.parse(inbox)
|
||||
|
||||
{:ok, data} = @transmogrifier_impl.prepare_outgoing(activity.data)
|
||||
{:ok, data} = @transmogrifier_impl.prepare_activity(activity.data)
|
||||
|
||||
{actor, data} =
|
||||
with {_, false} <- {:actor_changed?, data["actor"] != activity.data["actor"]} do
|
||||
{actor, data}
|
||||
else
|
||||
{:actor_changed?, true} ->
|
||||
# If prepare_outgoing changes the actor, re-get it from the db
|
||||
# If prepare_activity changes the actor, re-get it from the db
|
||||
new_actor = User.get_cached_by_ap_id(data["actor"])
|
||||
{new_actor, data}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -783,7 +783,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
|
||||
def set_replies(obj_data), do: obj_data
|
||||
|
||||
# Prepares the object of an outgoing create activity.
|
||||
# Prepares and sanitizes the object for federation.
|
||||
def prepare_object(object) do
|
||||
object
|
||||
|> add_hashtags
|
||||
|
|
@ -824,7 +824,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
# internal -> Mastodon
|
||||
# """
|
||||
|
||||
def prepare_outgoing(%{"type" => activity_type, "object" => object_id} = data)
|
||||
def prepare_activity(%{"type" => activity_type, "object" => object_id} = data)
|
||||
when activity_type in ["Create", "Listen"] do
|
||||
object =
|
||||
object_id
|
||||
|
|
@ -840,7 +840,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
{:ok, data}
|
||||
end
|
||||
|
||||
def prepare_outgoing(%{"type" => "Update", "object" => %{"type" => objtype} = object} = data)
|
||||
def prepare_activity(%{"type" => "Update", "object" => %{"type" => objtype} = object} = data)
|
||||
when objtype in Pleroma.Constants.updatable_object_types() do
|
||||
data =
|
||||
data
|
||||
|
|
@ -851,7 +851,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
{:ok, data}
|
||||
end
|
||||
|
||||
def prepare_outgoing(%{"type" => "Update", "object" => %{"type" => objtype} = object} = data)
|
||||
def prepare_activity(%{"type" => "Update", "object" => %{"type" => objtype} = object} = data)
|
||||
when objtype in Pleroma.Constants.actor_types() do
|
||||
object =
|
||||
object
|
||||
|
|
@ -868,11 +868,11 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
{:ok, data}
|
||||
end
|
||||
|
||||
def prepare_outgoing(%{"type" => "Update", "object" => %{}} = data) do
|
||||
def prepare_activity(%{"type" => "Update", "object" => %{}} = data) do
|
||||
raise "Requested to serve an Update for non-updateable object type: #{inspect(data)}"
|
||||
end
|
||||
|
||||
def prepare_outgoing(%{"type" => "Announce", "actor" => ap_id, "object" => object_id} = data) do
|
||||
def prepare_activity(%{"type" => "Announce", "actor" => ap_id, "object" => object_id} = data) do
|
||||
object =
|
||||
object_id
|
||||
|> Object.normalize(fetch: false)
|
||||
|
|
@ -895,7 +895,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
|
||||
# Mastodon Accept/Reject requires a non-normalized object containing the actor URIs,
|
||||
# because of course it does.
|
||||
def prepare_outgoing(%{"type" => "Accept"} = data) do
|
||||
def prepare_activity(%{"type" => "Accept"} = data) do
|
||||
with follow_activity <- Activity.normalize(data["object"]) do
|
||||
object = %{
|
||||
"actor" => follow_activity.actor,
|
||||
|
|
@ -913,7 +913,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_outgoing(%{"type" => "Reject"} = data) do
|
||||
def prepare_activity(%{"type" => "Reject"} = data) do
|
||||
with follow_activity <- Activity.normalize(data["object"]) do
|
||||
object = %{
|
||||
"actor" => follow_activity.actor,
|
||||
|
|
@ -931,7 +931,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_outgoing(%{"type" => "Flag"} = data) do
|
||||
def prepare_activity(%{"type" => "Flag"} = data) do
|
||||
with {:ok, stripped_activity} <- Utils.strip_report_status_data(data),
|
||||
stripped_activity <- Utils.maybe_anonymize_reporter(stripped_activity),
|
||||
stripped_activity <- Map.merge(stripped_activity, Utils.make_json_ld_header()) do
|
||||
|
|
@ -939,7 +939,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_outgoing(%{"type" => _type} = data) do
|
||||
def prepare_activity(%{"type" => _type} = data) do
|
||||
data =
|
||||
data
|
||||
|> strip_internal_fields
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.API do
|
|||
Behaviour for the subset of Transmogrifier used by Publisher.
|
||||
"""
|
||||
|
||||
@callback prepare_outgoing(map()) :: {:ok, map()} | {:error, term()}
|
||||
@callback prepare_activity(map()) :: {:ok, map()} | {:error, term()}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectView do
|
|||
end
|
||||
|
||||
def render("object.json", %{object: %Activity{} = activity}) do
|
||||
{:ok, ap_data} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, ap_data} = Transmogrifier.prepare_activity(activity.data)
|
||||
ap_data
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
|||
}) do
|
||||
collection =
|
||||
Enum.map(activities, fn activity ->
|
||||
{:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, data} = Transmogrifier.prepare_activity(activity.data)
|
||||
data
|
||||
end)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.HashtagPolicyTest do
|
|||
user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "#nsfw hey"})
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert modified["object"]["sensitive"]
|
||||
end
|
||||
|
|
@ -94,7 +94,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.HashtagPolicyTest do
|
|||
user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "#cofe hey"})
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
refute modified["object"]["sensitive"]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
|
|||
{:ok, edit} = Pleroma.Web.CommonAPI.update(activity, user, %{status: "edited :blank:"})
|
||||
|
||||
{:ok, %{"object" => external_rep}} =
|
||||
Pleroma.Web.ActivityPub.Transmogrifier.prepare_outgoing(edit.data)
|
||||
Pleroma.Web.ActivityPub.Transmogrifier.prepare_activity(edit.data)
|
||||
|
||||
%{external_rep: external_rep}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UpdateHandlingTest do
|
|||
user = insert(:user)
|
||||
{:ok, activity} = Pleroma.Web.CommonAPI.post(user, %{status: "mew mew :dinosaur:"})
|
||||
{:ok, edit} = Pleroma.Web.CommonAPI.update(activity, user, %{status: "edited :blank:"})
|
||||
{:ok, external_rep} = Pleroma.Web.ActivityPub.Transmogrifier.prepare_outgoing(edit.data)
|
||||
{:ok, external_rep} = Pleroma.Web.ActivityPub.Transmogrifier.prepare_activity(edit.data)
|
||||
%{external_rep: external_rep}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
)
|
||||
end
|
||||
|
||||
test "Publishes with the new actor if prepare_outgoing changes the actor." do
|
||||
test "Publishes with the new actor if prepare_activity changes the actor." do
|
||||
mock(fn
|
||||
%{method: :post, url: "https://domain.com/users/nick1/inbox", body: body} ->
|
||||
{:ok, %Tesla.Env{status: 200, body: body}}
|
||||
|
|
@ -281,7 +281,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
)
|
||||
|
||||
Pleroma.Web.ActivityPub.TransmogrifierMock
|
||||
|> Mox.expect(:prepare_outgoing, fn data ->
|
||||
|> Mox.expect(:prepare_activity, fn data ->
|
||||
{:ok, Map.put(data, "actor", replaced_actor.ap_id)}
|
||||
end)
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnswerHandlingTest do
|
|||
|> Kernel.put_in(["object", "to"], user.ap_id)
|
||||
|
||||
{:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
|
||||
{:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, data} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert data["object"]["type"] == "Note"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
|
|||
|
||||
{:ok, activity} = Transmogrifier.handle_incoming(message)
|
||||
|
||||
{:ok, _} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, _} = Transmogrifier.prepare_activity(activity.data)
|
||||
end
|
||||
|
||||
test "successfully reserializes a message with AS2 objects in IR" do
|
||||
|
|
@ -537,7 +537,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
|
|||
|
||||
{:ok, activity} = Transmogrifier.handle_incoming(message)
|
||||
|
||||
{:ok, _} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, _} = Transmogrifier.prepare_activity(activity.data)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
{:ok, announce_activity} = CommonAPI.repeat(activity.id, user)
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(announce_activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(announce_activity.data)
|
||||
|
||||
assert modified["object"]["content"] == "hey"
|
||||
assert modified["object"]["actor"] == modified["object"]["attributedTo"]
|
||||
|
|
@ -448,7 +448,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
with_mock Pleroma.Notification,
|
||||
get_notified_from_activity: fn _, _ -> [] end do
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
object = modified["object"]
|
||||
|
||||
|
|
@ -474,7 +474,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "hey"})
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert modified["@context"] == Utils.make_json_ld_header()["@context"]
|
||||
|
||||
|
|
@ -485,7 +485,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "hey"})
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert modified["object"]["actor"] == modified["object"]["attributedTo"]
|
||||
end
|
||||
|
|
@ -501,7 +501,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
"name" => "#2hu"
|
||||
}
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert modified["object"]["tag"] == [expected_tag]
|
||||
end
|
||||
|
|
@ -524,7 +524,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
url: "https://pleroma.social"
|
||||
} == activity.object.data["generator"]
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert length(modified["object"]["tag"]) == 2
|
||||
|
||||
|
|
@ -541,7 +541,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
test "it strips internal fields of article" do
|
||||
activity = insert(:article_activity)
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert length(modified["object"]["tag"]) == 2
|
||||
|
||||
|
|
@ -558,13 +558,13 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "2hu :moominmamma:"})
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert modified["directMessage"] == false
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "@#{other_user.nickname} :moominmamma:"})
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert modified["directMessage"] == false
|
||||
|
||||
|
|
@ -574,7 +574,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
visibility: "direct"
|
||||
})
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert modified["directMessage"] == true
|
||||
end
|
||||
|
|
@ -585,7 +585,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "foobar", visibility: "list:#{list.id}"})
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert is_nil(modified["bcc"])
|
||||
end
|
||||
|
|
@ -594,7 +594,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
listen_activity = insert(:listen)
|
||||
|
||||
# This has an inlined object as in ObjectView
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(listen_activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(listen_activity.data)
|
||||
|
||||
assert modified["type"] == "Listen"
|
||||
|
||||
|
|
@ -610,7 +610,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
object_type = activity.object.data["type"]
|
||||
|
||||
# This does not have an inlined object
|
||||
{:ok, modified2} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified2} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert match?(
|
||||
%{
|
||||
|
|
@ -640,7 +640,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "everybody do the dinosaur :dinosaur:"})
|
||||
|
||||
{:ok, prepared} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, prepared} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert length(prepared["object"]["tag"]) == 1
|
||||
|
||||
|
|
@ -655,7 +655,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
{:ok, activity} = CommonAPI.post(user, %{status: "everybody do the dinosaur :dinosaur:"})
|
||||
{:ok, update} = CommonAPI.update(activity, user, %{status: "mew mew :blank:"})
|
||||
|
||||
{:ok, prepared} = Transmogrifier.prepare_outgoing(update.data)
|
||||
{:ok, prepared} = Transmogrifier.prepare_activity(update.data)
|
||||
|
||||
assert %{
|
||||
"content" => "mew mew :blank:",
|
||||
|
|
@ -689,7 +689,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
user_update_changeset: changeset
|
||||
)
|
||||
|
||||
assert {:ok, prepared} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
assert {:ok, prepared} = Transmogrifier.prepare_activity(activity.data)
|
||||
assert prepared["type"] == "Update"
|
||||
assert prepared["@context"]
|
||||
assert prepared["object"]["type"] == user.actor_type
|
||||
|
|
@ -704,7 +704,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
{:ok, %Activity{} = block_activity} = CommonAPI.block(blocked, blocker)
|
||||
{:ok, %Activity{} = undo_activity} = CommonAPI.unblock(blocked, blocker)
|
||||
{:ok, data} = Transmogrifier.prepare_outgoing(undo_activity.data)
|
||||
{:ok, data} = Transmogrifier.prepare_activity(undo_activity.data)
|
||||
|
||||
block_ap_id = block_activity.data["id"]
|
||||
assert is_binary(block_ap_id)
|
||||
|
|
@ -738,7 +738,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
assert is_binary(note_ap_id)
|
||||
|
||||
{:ok, react_activity} = CommonAPI.react_with_emoji(note_activity.id, user, "🐈")
|
||||
{:ok, data} = Transmogrifier.prepare_outgoing(react_activity.data)
|
||||
{:ok, data} = Transmogrifier.prepare_activity(react_activity.data)
|
||||
|
||||
assert match?(
|
||||
%{
|
||||
|
|
@ -764,7 +764,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
note_activity = insert(:note_activity)
|
||||
|
||||
{:ok, react_activity} = CommonAPI.react_with_emoji(note_activity.id, user, ":dinosaur:")
|
||||
{:ok, data} = Transmogrifier.prepare_outgoing(react_activity.data)
|
||||
{:ok, data} = Transmogrifier.prepare_activity(react_activity.data)
|
||||
|
||||
assert length(data["tag"]) == 1
|
||||
|
||||
|
|
@ -781,7 +781,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
{:ok, quoted_post} = CommonAPI.post(user, %{status: "hey"})
|
||||
{:ok, quote_post} = CommonAPI.post(user, %{status: "hey", quoted_status_id: quoted_post.id})
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(quote_post.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(quote_post.data)
|
||||
|
||||
%{data: %{"id" => quote_id}} = Object.normalize(quoted_post)
|
||||
|
||||
|
|
@ -793,7 +793,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "Cześć", language: "pl"})
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.object.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.object.data)
|
||||
|
||||
assert [_, _, %{"@language" => "pl"}] = modified["@context"]
|
||||
end
|
||||
|
|
@ -802,7 +802,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "Cześć", language: "pl"})
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
assert [_, _, %{"@language" => "pl"}] = modified["@context"]
|
||||
end
|
||||
|
|
@ -825,7 +825,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
content: content
|
||||
})
|
||||
|
||||
{:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, data} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
expected_data =
|
||||
activity.data
|
||||
|
|
@ -859,7 +859,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
clear_config([:activitypub, :anonymize_reporter], true)
|
||||
clear_config([:activitypub, :anonymize_reporter_local_nickname], placeholder.nickname)
|
||||
|
||||
{:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
{:ok, data} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
expected_data =
|
||||
activity.data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue