if object = Object.get_by_ap_id(id), do: {:ok, object}, else: nil
end
- @doc
- """
- internal -> Mastodon
- """
- def prepare_outgoing(%{"type" => "Create", "object" => %{"type" => "Note"} = object} = data) do
- object = object
+ def prepare_object(object) do
+ object
|> set_sensitive
|> add_hashtags
|> add_mention_tags
|> add_attributed_to
|> prepare_attachments
|> set_conversation
+ end
+
+ @doc
+ """
+ internal -> Mastodon
+ """
+ def prepare_outgoing(%{"type" => "Create", "object" => %{"type" => "Note"} = object} = data) do
+ object = object
+ |> prepare_object
data = data
|> Map.put("object", object)
defmodule Pleroma.Web.ActivityPub.ObjectView do
use Pleroma.Web, :view
+ alias Pleroma.Web.ActivityPub.Transmogrifier
def render("object.json", %{object: object}) do
base = %{
]
}
- additional = Map.take(object.data, ["id", "to", "cc", "actor", "content", "summary", "type"])
- |> Map.put("attributedTo", object.data["actor"])
+ additional = Transmogrifier.prepare_object(object.data)
Map.merge(base, additional)
end
end