end
field(:replies, {:array, ObjectValidators.ObjectID}, default: [])
+ field(:source, :map)
end
def cast_and_apply(data) do
defp fix_replies(data), do: data
+ # https://github.com/misskey-dev/misskey/pull/8787
+ defp fix_misskey_content(%{"source" => %{"mediaType" => "text/x.misskeymarkdown"}} = object), do: object
+
+ defp fix_misskey_content(%{"_misskey_content" => content} = object) do
+ object
+ |> Map.put("source", %{"content" => content, "mediaType" => "text/x.misskeymarkdown" })
+ |> Map.delete("_misskey_content")
+ end
+
+ defp fix_misskey_content(data), do: data
+
defp fix(data) do
data
|> CommonFixes.fix_actor()
|> fix_url()
|> fix_tag()
|> fix_replies()
+ |> fix_misskey_content()
|> Transmogrifier.fix_emoji()
|> Transmogrifier.fix_content_map()
end
def render("index.json", opts) do
reading_user = opts[:for]
-
# To do: check AdminAPIControllerTest on the reasons behind nil activities in the list
activities = Enum.filter(opts.activities, & &1)
)
{pinned?, pinned_at} = pin_data(object, user)
-
%{
id: to_string(activity.id),
uri: object.data["id"],
emoji_reactions: emoji_reactions,
parent_visible: visible_for_user?(reply_to, opts[:for]),
pinned_at: pinned_at
+ },
+ akkoma: %{
+ source: object.data["source"]
}
}
end